aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/tar_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-27 19:27:18 +0900
committerOphestra <cat@gensokyo.uk>2026-01-27 20:18:34 +0900
commit968d8dbaf14fa0e7965a8a525d74a2d8d6a20c50 (patch)
tree9ba3503fbc586eb504dfacfa3a471ff68a39b1e2 /internal/pkg/tar_test.go
parentf1758a6fa8621777cb9129443b6de193c885228f (diff)
internal/pkg: encode checksum in ident
This also rearranges the ident ir to be more predictable, and avoids an obvious and somewhat easy to get into inconsistent state. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pkg/tar_test.go')
-rw-r--r--internal/pkg/tar_test.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/internal/pkg/tar_test.go b/internal/pkg/tar_test.go
index d9635fb5..3e611df6 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("sxbgyX-bPoezbha214n2lbQhiVfTUBkhZ0EX6zI7mmkMdrCdwuMwhMBJphLQsy94")},
+ }, pkg.MustDecode("nnOiyjjjvgZChsGtO4rA1JHckwYBBbxwNfecPJp62OFP6aoYUxHQ5UtYsrDpnwan")},
{"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("4I8wx_h7NSJTlG5lbuz-GGEXrOg0GYC3M_503LYEBhv5XGWXfNIdIY9Q3eVSYldX")},
+ }, pkg.MustDecode("bQVH19N7dX50SdQ6JNVYbFdDZV4t8IaM4dhxGvjACpdoEgJ2jZJfYKLH4ya7ZD_s")},
})
}
@@ -99,13 +99,17 @@ func checkTarHTTP(
wantIdent := func() pkg.ID {
h := sha512.New384()
h.Write([]byte{byte(pkg.KindTar), 0, 0, 0, 0, 0, 0, 0})
- h.Write([]byte{pkg.TarGzip, 0, 0, 0, 0, 0, 0, 0})
- h.Write([]byte{byte(pkg.KindHTTPGet), 0, 0, 0, 0, 0, 0, 0})
+ h.Write([]byte{byte(pkg.KindHTTPGet), 0, 0, 0, 0, 0, 0, 0})
h0 := sha512.New384()
h0.Write([]byte{byte(pkg.KindHTTPGet), 0, 0, 0, 0, 0, 0, 0})
+ h0.Write(testdataChecksum[:])
h0.Write([]byte("file:///testdata"))
h.Write(h0.Sum(nil))
+
+ h.Write(make([]byte, len(pkg.Checksum{})))
+ h.Write([]byte{pkg.TarGzip, 0, 0, 0, 0, 0, 0, 0})
+
return pkg.ID(h.Sum(nil))
}()