update_test.go 706 B

1234567891011121314151617181920212223242526
  1. package service
  2. import (
  3. "testing"
  4. "github.com/docker/docker/pkg/testutil/assert"
  5. "github.com/docker/engine-api/types/swarm"
  6. )
  7. func TestUpdateServiceCommandAndArgs(t *testing.T) {
  8. flags := newUpdateCommand(nil).Flags()
  9. flags.Set("command", "the")
  10. flags.Set("command", "new")
  11. flags.Set("command", "command")
  12. flags.Set("arg", "the")
  13. flags.Set("arg", "new args")
  14. spec := &swarm.ServiceSpec{}
  15. cspec := &spec.TaskTemplate.ContainerSpec
  16. cspec.Command = []string{"old", "command"}
  17. cspec.Args = []string{"old", "args"}
  18. updateService(flags, spec)
  19. assert.EqualStringSlice(t, cspec.Command, []string{"the", "new", "command"})
  20. assert.EqualStringSlice(t, cspec.Args, []string{"the", "new args"})
  21. }