Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix cli annotation flagSet to StringArrayVar #2702

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/common_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func addCommonFlags(flagSet *pflag.FlagSet) *container {
flagSet.StringVar(&c.quotaID, "quota-id", "", "Specified quota id, if id < 0, it means pouchd alloc a unique quota id")

// additional runtime spec annotations
flagSet.StringSliceVar(&c.specAnnotation, "annotation", nil, "Additional annotation for runtime")
flagSet.StringArrayVar(&c.specAnnotation, "annotation", nil, "Additional annotation for runtime")

// nvidia container
flagSet.StringVar(&c.nvidiaDriverCapabilities, "nvidia-capabilities", "", "NvidiaDriverCapabilities controls which driver libraries/binaries will be mounted inside the container")
Expand Down
3 changes: 2 additions & 1 deletion test/cli_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func (suite *PouchCreateSuite) TestCreateWithOOMOption(c *check.C) {
func (suite *PouchCreateSuite) TestCreateWithAnnotation(c *check.C) {
cname := "TestCreateWithAnnotation"
res := command.PouchRun("create", "--annotation", "a=b", "--annotation", "foo=bar",
"--name", cname, busyboxImage)
"--annotation", "k1=v1,v2", "--name", cname, busyboxImage)
defer DelContainerForceMultyTime(c, cname)
res.Assert(c, icmd.Success)

Expand All @@ -431,6 +431,7 @@ func (suite *PouchCreateSuite) TestCreateWithAnnotation(c *check.C) {

c.Assert(util.PartialEqual(annotationStr, "a=b"), check.IsNil)
c.Assert(util.PartialEqual(annotationStr, "foo=bar"), check.IsNil)
c.Assert(util.PartialEqual(annotationStr, "k1=v1,v2"), check.IsNil)
}

// TestCreateWithUlimit tests creating container with annotation.
Expand Down