From 17b32e6a452ebded4f18fb9177240d8d12e9417c Mon Sep 17 00:00:00 2001 From: "allen.wang" Date: Tue, 29 Jan 2019 20:54:13 +0800 Subject: [PATCH] fix cli annotation flagSet to StringArrayVar Signed-off-by: allen.wang --- cli/common_flags.go | 2 +- test/cli_create_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/common_flags.go b/cli/common_flags.go index c50562546..a34ee99e8 100644 --- a/cli/common_flags.go +++ b/cli/common_flags.go @@ -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") diff --git a/test/cli_create_test.go b/test/cli_create_test.go index 7e0bb8708..dacf8c221 100644 --- a/test/cli_create_test.go +++ b/test/cli_create_test.go @@ -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) @@ -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.