Skip to content

Commit

Permalink
Fix double time import in e2e tests (sigstore#1388)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
saschagrunert authored and Marc Hildenbrand committed Apr 19, 2022
1 parent 63acd31 commit 7ada374
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
"path/filepath"
"testing"
"time"
ftime "time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-containerregistry/pkg/authn"
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -498,15 +497,15 @@ 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
must(cliverify.VerifyBlobCmd(ctx, ko1, "", "", "", "", bp), 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)
}

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 7ada374

Please sign in to comment.