Skip to content

Commit

Permalink
fix: add E2E plugin credentials check
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Jul 20, 2023
1 parent 050bff0 commit 97aa497
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/e2e/plugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,31 @@ package main

import (
"encoding/json"
"errors"
"os"

"github.com/notaryproject/notation-go/plugin/proto"
"github.com/spf13/cobra"
)

const NOTATION_USERNAME = "NOTATION_USERNAME"
const NOTATION_PASSWORD = "NOTATION_PASSWORD"

func main() {
cmd := &cobra.Command{
Use: "plugin for Notation E2E test",
SilenceUsage: true,
SilenceErrors: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// check registry credentials are eliminated
if os.Getenv(NOTATION_USERNAME) != "" || os.Getenv(NOTATION_PASSWORD) != "" {
return &proto.RequestError{
Code: proto.ErrorCodeValidation,
Err: errors.New("registry credentials are not eliminated"),
}
}
return nil
},
}

cmd.AddCommand(
Expand Down

0 comments on commit 97aa497

Please sign in to comment.