Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <[email protected]>
  • Loading branch information
Two-Hearts committed Jan 9, 2025
1 parent 94b586a commit ce63a53
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 23 deletions.
1 change: 0 additions & 1 deletion test/e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
github.com/notaryproject/tspclient-go v1.0.0-rc.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
Expand Down
21 changes: 1 addition & 20 deletions test/e2e/suite/command/blob/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ package blob
import (
"fmt"
"path/filepath"
"strings"

"github.com/notaryproject/notation-core-go/signature/cose"
"github.com/notaryproject/notation-core-go/signature/jws"
. "github.com/notaryproject/notation/test/e2e/internal/notation"
"github.com/notaryproject/notation/test/e2e/internal/utils"
. "github.com/notaryproject/notation/test/e2e/suite/common"
Expand All @@ -36,28 +33,12 @@ var _ = Describe("notation blob verify", func() {
MatchKeyWords("Signature file written to")

signaturePath := signatureFilepath(blobDir, blobPath, "jws")
signatureMediaType, err := parseSignatureMediaType(signaturePath)
if err != nil {
Fail(err.Error())
}
notation.Exec("blob", "verify", "--signature", signatureMediaType, blobPath).
notation.Exec("blob", "verify", "--signature", signaturePath, blobPath).
MatchKeyWords(VerifySuccessfully)
})
})
})

func parseSignatureMediaType(signaturePath string) (string, error) {
signatureFileName := filepath.Base(signaturePath)
format := strings.Split(signatureFileName, ".")[1]
switch format {
case "cose":
return cose.MediaTypeEnvelope, nil
case "jws":
return jws.MediaTypeEnvelope, nil
}
return "", fmt.Errorf("unsupported signature format %s", format)
}

func signatureFilepath(signatureDirectory, blobPath, signatureFormat string) string {
blobFilename := filepath.Base(blobPath)
signatureFilename := fmt.Sprintf("%s.%s.sig", blobFilename, signatureFormat)
Expand Down

0 comments on commit ce63a53

Please sign in to comment.