mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
07b59ef210
add a unit test Signed-off-by: Daniel Nephin <dnephin@docker.com>
26 lines
706 B
Go
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"})
|
|
}
|