1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/client/service/update_test.go
Daniel Nephin 07b59ef210 Fix service update of Args
add a unit test

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-06-29 12:41:57 -04:00

26 lines
706 B
Go

package service
import (
"testing"
"github.com/docker/docker/pkg/testutil/assert"
"github.com/docker/engine-api/types/swarm"
)
func TestUpdateServiceCommandAndArgs(t *testing.T) {
flags := newUpdateCommand(nil).Flags()
flags.Set("command", "the")
flags.Set("command", "new")
flags.Set("command", "command")
flags.Set("arg", "the")
flags.Set("arg", "new args")
spec := &swarm.ServiceSpec{}
cspec := &spec.TaskTemplate.ContainerSpec
cspec.Command = []string{"old", "command"}
cspec.Args = []string{"old", "args"}
updateService(flags, spec)
assert.EqualStringSlice(t, cspec.Command, []string{"the", "new", "command"})
assert.EqualStringSlice(t, cspec.Args, []string{"the", "new args"})
}