From 7ada3740a441550f0bf5c876b31a7bc2c796a3be Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Wed, 2 Feb 2022 11:40:45 +0100 Subject: [PATCH] Fix double `time` import in e2e tests (#1388) Just saw this little nit while fixing the e2e tests in another PR. I think we can also avoid the time conversions because we already pass the correct type to the functions. Signed-off-by: Sascha Grunert --- test/e2e_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/e2e_test.go b/test/e2e_test.go index 95b248d04d69..e73fab512adb 100644 --- a/test/e2e_test.go +++ b/test/e2e_test.go @@ -33,7 +33,6 @@ import ( "path/filepath" "testing" "time" - ftime "time" "github.com/google/go-cmp/cmp" "github.com/google/go-containerregistry/pkg/authn" @@ -233,7 +232,7 @@ func TestAttestVerify(t *testing.T) { // Now attest the image ko := sign.KeyOpts{KeyRef: privKeyPath, PassFunc: passFunc} must(attest.AttestCmd(ctx, ko, options.RegistryOptions{}, imgName, "", false, slsaAttestationPath, false, - "custom", false, ftime.Duration(30*time.Second)), t) + "custom", false, 30*time.Second), t) // Use cue to verify attestation policyPath := filepath.Join(td, "policy.cue") @@ -458,7 +457,7 @@ func TestSignBlob(t *testing.T) { KeyRef: privKeyPath1, PassFunc: passFunc, } - sig, err := sign.SignBlobCmd(ctx, ko, options.RegistryOptions{}, bp, true, "", "", time.Duration(30*time.Second)) + sig, err := sign.SignBlobCmd(ctx, ko, options.RegistryOptions{}, bp, true, "", "", 30*time.Second) if err != nil { t.Fatal(err) } @@ -498,7 +497,7 @@ func TestSignBlobBundle(t *testing.T) { BundlePath: bundlePath, RekorURL: rekorURL, } - if _, err := sign.SignBlobCmd(ctx, ko, options.RegistryOptions{}, bp, true, "", "", time.Duration(30*time.Second)); err != nil { + if _, err := sign.SignBlobCmd(ctx, ko, options.RegistryOptions{}, bp, true, "", "", 30*time.Second); err != nil { t.Fatal(err) } // Now verify should work @@ -506,7 +505,7 @@ func TestSignBlobBundle(t *testing.T) { // Now we turn on the tlog and sign again defer setenv(t, options.ExperimentalEnv, "1")() - if _, err := sign.SignBlobCmd(ctx, ko, options.RegistryOptions{}, bp, true, "", "", time.Duration(30*time.Second)); err != nil { + if _, err := sign.SignBlobCmd(ctx, ko, options.RegistryOptions{}, bp, true, "", "", 30*time.Second); err != nil { t.Fatal(err) } @@ -845,7 +844,7 @@ func TestSaveLoadAttestation(t *testing.T) { // Now attest the image ko = sign.KeyOpts{KeyRef: privKeyPath, PassFunc: passFunc} must(attest.AttestCmd(ctx, ko, options.RegistryOptions{}, imgName, "", false, slsaAttestationPath, false, - "custom", false, ftime.Duration(30*time.Second)), t) + "custom", false, 30*time.Second), t) // save the image to a temp dir imageDir := t.TempDir()