From 274af8b436e2c1541a11013b98f5558360d8937c Mon Sep 17 00:00:00 2001 From: Meredith Lancaster Date: Fri, 15 Mar 2024 13:34:11 -0600 Subject: [PATCH] normalize all relative paths Signed-off-by: Meredith Lancaster --- pkg/cmd/attestation/inspect/inspect_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/cmd/attestation/inspect/inspect_test.go b/pkg/cmd/attestation/inspect/inspect_test.go index 092e24aaf..da9449635 100644 --- a/pkg/cmd/attestation/inspect/inspect_test.go +++ b/pkg/cmd/attestation/inspect/inspect_test.go @@ -50,8 +50,8 @@ func TestNewInspectCmd(t *testing.T) { name: "Invalid digest-alg flag", cli: "../test/data/sigstore-js-2.1.0.tgz --bundle ../test/data/sigstore-js-2.1.0-bundle.json --digest-alg sha384", wants: Options{ - ArtifactPath: "../test/data/sigstore-js-2.1.0.tgz", - BundlePath: "../test/data/sigstore-js-2.1.0-bundle.json", + ArtifactPath: artifactPath, + BundlePath: bundlePath, DigestAlgorithm: "sha384", OCIClient: oci.MockClient{}, }, @@ -61,8 +61,8 @@ func TestNewInspectCmd(t *testing.T) { name: "Use default digest-alg value", cli: "../test/data/sigstore-js-2.1.0.tgz --bundle ../test/data/sigstore-js-2.1.0-bundle.json", wants: Options{ - ArtifactPath: "../test/data/sigstore-js-2.1.0.tgz", - BundlePath: "../test/data/sigstore-js-2.1.0-bundle.json", + ArtifactPath: artifactPath, + BundlePath: bundlePath, DigestAlgorithm: "sha256", OCIClient: oci.MockClient{}, }, @@ -72,8 +72,8 @@ func TestNewInspectCmd(t *testing.T) { name: "Use custom digest-alg value", cli: "../test/data/sigstore-js-2.1.0.tgz --bundle ../test/data/sigstore-js-2.1.0-bundle.json --digest-alg sha512", wants: Options{ - ArtifactPath: "../test/data/sigstore-js-2.1.0.tgz", - BundlePath: "../test/data/sigstore-js-2.1.0-bundle.json", + ArtifactPath: artifactPath, + BundlePath: bundlePath, DigestAlgorithm: "sha512", OCIClient: oci.MockClient{}, }, @@ -83,7 +83,7 @@ func TestNewInspectCmd(t *testing.T) { name: "Missing bundle flag", cli: "../test/data/sigstore-js-2.1.0.tgz", wants: Options{ - ArtifactPath: "../test/data/sigstore-js-2.1.0.tgz", + ArtifactPath: artifactPath, DigestAlgorithm: "sha256", OCIClient: oci.MockClient{}, }, @@ -135,13 +135,13 @@ func TestRunInspect(t *testing.T) { t.Run("with missing artifact path", func(t *testing.T) { customOpts := opts - customOpts.ArtifactPath = "../test/data/non-existent-artifact.zip" + customOpts.ArtifactPath = test.NormalizeRelativePath("../test/data/non-existent-artifact.zip") require.Error(t, runInspect(&customOpts)) }) t.Run("with missing bundle path", func(t *testing.T) { customOpts := opts - customOpts.BundlePath = "../test/data/non-existent-sigstoreBundle.json" + customOpts.BundlePath = test.NormalizeRelativePath("../test/data/non-existent-sigstoreBundle.json") require.Error(t, runInspect(&customOpts)) })