Skip to content

Commit

Permalink
fix update annotation to support comma
Browse files Browse the repository at this point in the history
Signed-off-by: allen.wang <[email protected]>
  • Loading branch information
wangforthinker authored and Novicei committed Jul 18, 2022
1 parent 6af4c26 commit 6eca67b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 55,7 @@ func (uc *UpdateCommand) addFlags() {
flagSet.StringSliceVarP(&uc.labels, "label", "l", nil, "Update labels for container")
flagSet.StringVar(&uc.restartPolicy, "restart", "", "Restart policy to apply when container exits")
flagSet.StringSliceVar(&uc.diskQuota, "disk-quota", nil, "Update disk quota for container(/=10g)")
flagSet.StringSliceVar(&uc.specAnnotation, "annotation", nil, "Update annotation for runtime spec")
flagSet.StringArrayVar(&uc.specAnnotation, "annotation", nil, "Update annotation for runtime spec")
}

// updateRun is the entry of update command.
Expand Down
6 changes: 3 additions & 3 deletions test/cli_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 582,17 @@ func (suite *PouchUpdateSuite) TestUpdateAnnotation(c *check.C) {
defer DelContainerForceMultyTime(c, cname)

annotation1Update := "key1=value1.new"
annotation2Update := "key2=value2.new"
annotation2Update := "key2=value2,value3"

command.PouchRun("update", "--annotation", annotation1Update, cname).Assert(c, icmd.Success)
checkContainerAnnotation(c, cname, "key1", "value1.new")
checkContainerAnnotation(c, cname, "key2", "value2")

command.PouchRun("update", "--annotation", annotation2Update, cname).Assert(c, icmd.Success)
checkContainerAnnotation(c, cname, "key1", "value1.new")
checkContainerAnnotation(c, cname, "key2", "value2.new")
checkContainerAnnotation(c, cname, "key2", "value2,value3")

command.PouchRun("restart", cname).Assert(c, icmd.Success)
checkContainerAnnotation(c, cname, "key1", "value1.new")
checkContainerAnnotation(c, cname, "key2", "value2.new")
checkContainerAnnotation(c, cname, "key2", "value2,value3")
}

0 comments on commit 6eca67b

Please sign in to comment.