Skip to content

Commit

Permalink
fix cli annotation flagSet to StringArrayVar
Browse files Browse the repository at this point in the history
Signed-off-by: allen.wang <allen.wq@alipay.com>
  • Loading branch information
wangforthinker authored and fuweid committed Jan 29, 2019
1 parent 42992ba commit 1490a08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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

0 comments on commit 1490a08

Please sign in to comment.