Skip to content

Commit db752ea

Browse files
committed
please
1 parent 62209a0 commit db752ea

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

provisioner/terraform/modules_internal_test.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package terraform
22

33
import (
4+
"archive/tar"
45
"bytes"
56
"crypto/sha256"
67
"encoding/hex"
8+
"errors"
9+
"fmt"
10+
"io"
711
"io/fs"
812
"os"
913
"path/filepath"
@@ -54,13 +58,22 @@ func TestGetModulesArchive(t *testing.T) {
5458
_, err = fs.ReadFile(tarfs, ".terraform/modules/stuff_that_should_not_be_included/nothing.txt")
5559
require.Error(t, err)
5660

61+
r := tar.NewReader(bytes.NewBuffer(archive))
62+
for {
63+
h, err := r.Next()
64+
if errors.Is(err, io.EOF) {
65+
break
66+
}
67+
fmt.Printf("- %v (%v) [%v:%v] %#v\n", h.Name, h.Size, h.Uid, h.Gid, h)
68+
}
69+
5770
// It should always be byte-identical to optimize storage
5871
hashBytes := sha256.Sum256(archive)
5972
hash := hex.EncodeToString(hashBytes[:])
6073
if runtime.GOOS != "windows" {
61-
require.Equal(t, "8491a8ab368f00a7eb0e927a957a3b0e4bf5df322c5b330d7b92b8b043a3d1d9", hash)
74+
require.Equal(t, "edcccdd4db68869552542e66bad87a51e2e455a358964912805a32b06123cb5c", hash)
6275
} else {
63-
require.Equal(t, "d15ae1791f19122a3ead806a225e1b79140432397b3543605505fe8b66e6ddf6", hash)
76+
require.Equal(t, "67027a27452d60ce2799fcfd70329c185f9aee7115b0944e3aa00b4776be9d92", hash)
6477
}
6578
})
6679

0 commit comments

Comments
 (0)