aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/tar_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg/tar_test.go')
-rw-r--r--internal/pkg/tar_test.go31
1 files changed, 25 insertions, 6 deletions
diff --git a/internal/pkg/tar_test.go b/internal/pkg/tar_test.go
index 3e611df6..26a67d6c 100644
--- a/internal/pkg/tar_test.go
+++ b/internal/pkg/tar_test.go
@@ -40,7 +40,7 @@ func TestTar(t *testing.T) {
}, pkg.MustDecode(
"cTw0h3AmYe7XudSoyEMByduYXqGi-N5ZkTZ0t9K5elsu3i_jNIVF5T08KR1roBFM",
))
- }, pkg.MustDecode("nnOiyjjjvgZChsGtO4rA1JHckwYBBbxwNfecPJp62OFP6aoYUxHQ5UtYsrDpnwan")},
+ }, pkg.MustDecode("NQTlc466JmSVLIyWklm_u8_g95jEEb98PxJU-kjwxLpfdjwMWJq0G8ze9R4Vo1Vu")},
{"http expand", nil, func(t *testing.T, base *check.Absolute, c *pkg.Cache) {
checkTarHTTP(t, base, c, fstest.MapFS{
@@ -51,7 +51,7 @@ func TestTar(t *testing.T) {
}, pkg.MustDecode(
"CH3AiUrCCcVOjOYLaMKKK1Da78989JtfHeIsxMzWOQFiN4mrCLDYpoDxLWqJWCUN",
))
- }, pkg.MustDecode("bQVH19N7dX50SdQ6JNVYbFdDZV4t8IaM4dhxGvjACpdoEgJ2jZJfYKLH4ya7ZD_s")},
+ }, pkg.MustDecode("hSoSSgCYTNonX3Q8FjvjD1fBl-E-BQyA6OTXro2OadXqbST4tZ-akGXszdeqphRe")},
})
}
@@ -98,17 +98,36 @@ func checkTarHTTP(
wantIdent := func() pkg.ID {
h := sha512.New384()
+
+ // kind uint64
h.Write([]byte{byte(pkg.KindTar), 0, 0, 0, 0, 0, 0, 0})
+ // deps_sz uint64
+ h.Write([]byte{1, 0, 0, 0, 0, 0, 0, 0})
+ // kind uint64
h.Write([]byte{byte(pkg.KindHTTPGet), 0, 0, 0, 0, 0, 0, 0})
+ // ident ID
h0 := sha512.New384()
+ // kind uint64
h0.Write([]byte{byte(pkg.KindHTTPGet), 0, 0, 0, 0, 0, 0, 0})
- h0.Write(testdataChecksum[:])
+ // deps_sz uint64
+ h0.Write([]byte{0, 0, 0, 0, 0, 0, 0, 0})
+ // url string
+ h0.Write([]byte{byte(pkg.IRKindString), 0, 0, 0})
+ h0.Write([]byte{0x10, 0, 0, 0})
h0.Write([]byte("file:///testdata"))
+ // end(KnownChecksum)
+ h0.Write([]byte{byte(pkg.IRKindEnd), 0, 0, 0})
+ h0.Write([]byte{byte(pkg.IREndKnownChecksum), 0, 0, 0})
+ // checksum Checksum
+ h0.Write(testdataChecksum[:])
h.Write(h0.Sum(nil))
-
- h.Write(make([]byte, len(pkg.Checksum{})))
- h.Write([]byte{pkg.TarGzip, 0, 0, 0, 0, 0, 0, 0})
+ // compression uint32
+ h.Write([]byte{byte(pkg.IRKindUint32), 0, 0, 0})
+ h.Write([]byte{pkg.TarGzip, 0, 0, 0})
+ // end
+ h.Write([]byte{byte(pkg.IRKindEnd), 0, 0, 0})
+ h.Write([]byte{0, 0, 0, 0})
return pkg.ID(h.Sum(nil))
}()