MCPcopy Index your code
hub / github.com/docker/cli / TestUpdateReadOnly

Function TestUpdateReadOnly

cli/command/service/update_test.go:568–592  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

566}
567
568func TestUpdateReadOnly(t *testing.T) {
569 spec := &swarm.ServiceSpec{
570 TaskTemplate: swarm.TaskSpec{
571 ContainerSpec: &swarm.ContainerSpec{},
572 },
573 }
574 cspec := spec.TaskTemplate.ContainerSpec
575
576 // Update with --read-only=true, changed to true
577 flags := newUpdateCommand(nil).Flags()
578 flags.Set("read-only", "true")
579 updateService(context.TODO(), nil, flags, spec)
580 assert.Check(t, cspec.ReadOnly)
581
582 // Update without --read-only, no change
583 flags = newUpdateCommand(nil).Flags()
584 updateService(context.TODO(), nil, flags, spec)
585 assert.Check(t, cspec.ReadOnly)
586
587 // Update with --read-only=false, changed to false
588 flags = newUpdateCommand(nil).Flags()
589 flags.Set("read-only", "false")
590 updateService(context.TODO(), nil, flags, spec)
591 assert.Check(t, !cspec.ReadOnly)
592}
593
594func TestUpdateInit(t *testing.T) {
595 spec := &swarm.ServiceSpec{

Callers

nothing calls this directly

Calls 3

updateServiceFunction · 0.85
newUpdateCommandFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…