diff options
Diffstat (limited to 'internal/pkg/tar_test.go')
| -rw-r--r-- | internal/pkg/tar_test.go | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/internal/pkg/tar_test.go b/internal/pkg/tar_test.go index 309a1c76..feff9c14 100644 --- a/internal/pkg/tar_test.go +++ b/internal/pkg/tar_test.go @@ -74,12 +74,13 @@ func TestTar(t *testing.T) { 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.KindHTTP), 0, 0, 0, 0, 0, 0, 0}) - h.Write(testdataChecksum[:]) + h.Write([]byte{byte(pkg.KindHTTPGet), 0, 0, 0, 0, 0, 0, 0}) + httpIdent := pkg.KindHTTPGet.Ident([]byte("file:///testdata")) + h.Write(httpIdent[:]) return pkg.ID(h.Sum(nil)) }() - a, err := pkg.NewHTTPGetTar( + a := pkg.NewHTTPGetTar( t.Context(), &client, "file:///testdata", @@ -87,16 +88,10 @@ func TestTar(t *testing.T) { pkg.TarGzip, ) - if err != nil { - t.Fatalf("NewHTTPGetTar: error = %v", err) - } else if id := pkg.Ident(a); id != wantIdent { + if id := pkg.Ident(a); id != wantIdent { t.Fatalf("Ident: %s, want %s", pkg.Encode(id), pkg.Encode(wantIdent)) } - var ( - pathname *check.Absolute - checksum pkg.Checksum - ) wantPathname := base.Append( "identifier", pkg.Encode(wantIdent), @@ -104,7 +99,7 @@ func TestTar(t *testing.T) { wantChecksum := pkg.MustDecode( "yJlSb2A3jxaMLuKqwp1GwHOguAHddS9MjygF9ICEeegKfRvgLPdPmNh8mva47f8o", ) - if pathname, checksum, err = c.Cure(a); err != nil { + if pathname, checksum, err := c.Cure(a); err != nil { t.Fatalf("Cure: error = %v", err) } else if !pathname.Is(wantPathname) { t.Fatalf("Cure: %q, want %q", pathname, wantPathname) @@ -114,6 +109,6 @@ func TestTar(t *testing.T) { Want: wantChecksum, }) } - }, pkg.MustDecode("p1HdTOQhIeWzpXdZ45xo00H9CFeXNIvazxOhBAfExlhFO64zt7TUbxoLJ2eAL5oc")}, + }, pkg.MustDecode("lmVlYEGNFkwGVpzzS8KYjGBVB6FCyPtk9ViX88zen0GgTKLgGqO6eFxb4dpcP6bR")}, }) } |
