Skip to content

Commit

Permalink
fix: update test
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
  • Loading branch information
JeyJeyGao committed May 30, 2024
1 parent 2b004f6 commit ad729c4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugin/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestGetMetadata(t *testing.T) {
t.Run("plugin error is in invalid json format", func(t *testing.T) {
exitErr := errors.New("unknown error")
stderr := []byte("sad")
expectedErrMsg := "failed to execute the get-plugin-metadata command for plugin test-plugin: sad"
expectedErrMsg := "invalid character 's' looking for beginning of value"
plugin := CLIPlugin{name: "test-plugin"}
executor = testCommander{stdout: nil, stderr: stderr, err: exitErr}
_, err := plugin.GetMetadata(context.Background(), &proto.GetMetadataRequest{})
Expand All @@ -55,7 +55,7 @@ func TestGetMetadata(t *testing.T) {
t.Run("plugin cause system error", func(t *testing.T) {
exitErr := errors.New("system error")
stderr := []byte("")
expectedErrMsg := "failed to execute the get-plugin-metadata command for plugin test-plugin"
expectedErrMsg := "system error"
plugin := CLIPlugin{name: "test-plugin"}
executor = testCommander{stdout: nil, stderr: stderr, err: exitErr}
_, err := plugin.GetMetadata(context.Background(), &proto.GetMetadataRequest{})
Expand Down
2 changes: 1 addition & 1 deletion plugin/proto/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

func TestRequestError_Error(t *testing.T) {
err := RequestError{Code: ErrorCodeAccessDenied, Err: errors.New("an error")}
want := string(ErrorCodeAccessDenied) + ": an error"
want := "an error"
if got := err.Error(); got != want {
t.Errorf("RequestError.Error() = %v, want %v", got, want)
}
Expand Down
2 changes: 1 addition & 1 deletion verifier/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ func assertPluginVerification(scheme signature.SigningScheme, t *testing.T) {
VerificationLevel: verificationLevel,
}
outcome, err = v.Verify(context.Background(), mock.ImageDescriptor, pluginSigEnv, opts)
if err == nil || outcome.Error == nil || outcome.Error.Error() != "invalid plugin response" {
if err == nil || outcome.Error == nil || outcome.Error.Error() != "failed to verify with plugin plugin-name: invalid plugin response" {
t.Fatalf("verification should fail when the verification plugin returns unexpected response. error : %v", outcome.Error)
}

Expand Down

0 comments on commit ad729c4

Please sign in to comment.