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

Function TestSwarmUnlockKey

cli/command/swarm/unlock_key_test.go:106–185  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

104}
105
106func TestSwarmUnlockKey(t *testing.T) {
107 testCases := []struct {
108 name string
109 flags map[string]string
110 swarmInspectFunc func() (client.SwarmInspectResult, error)
111 swarmUpdateFunc func(client.SwarmUpdateOptions) (client.SwarmUpdateResult, error)
112 swarmGetUnlockKeyFunc func() (client.SwarmGetUnlockKeyResult, error)
113 }{
114 {
115 name: "unlock-key",
116 swarmGetUnlockKeyFunc: func() (client.SwarmGetUnlockKeyResult, error) {
117 return client.SwarmGetUnlockKeyResult{
118 Key: "unlock-key",
119 }, nil
120 },
121 },
122 {
123 name: "unlock-key-quiet",
124 flags: map[string]string{
125 flagQuiet: "true",
126 },
127 swarmGetUnlockKeyFunc: func() (client.SwarmGetUnlockKeyResult, error) {
128 return client.SwarmGetUnlockKeyResult{
129 Key: "unlock-key",
130 }, nil
131 },
132 },
133 {
134 name: "unlock-key-rotate",
135 flags: map[string]string{
136 flagRotate: "true",
137 },
138 swarmInspectFunc: func() (client.SwarmInspectResult, error) {
139 return client.SwarmInspectResult{
140 Swarm: *builders.Swarm(builders.Autolock()),
141 }, nil
142 },
143 swarmGetUnlockKeyFunc: func() (client.SwarmGetUnlockKeyResult, error) {
144 return client.SwarmGetUnlockKeyResult{
145 Key: "unlock-key",
146 }, nil
147 },
148 },
149 {
150 name: "unlock-key-rotate-quiet",
151 flags: map[string]string{
152 flagQuiet: "true",
153 flagRotate: "true",
154 },
155 swarmInspectFunc: func() (client.SwarmInspectResult, error) {
156 return client.SwarmInspectResult{
157 Swarm: *builders.Swarm(builders.Autolock()),
158 }, nil
159 },
160 swarmGetUnlockKeyFunc: func() (client.SwarmGetUnlockKeyResult, error) {
161 return client.SwarmGetUnlockKeyResult{
162 Key: "unlock-key",
163 }, nil

Callers

nothing calls this directly

Calls 7

OutBufferMethod · 0.95
newUnlockKeyCommandFunction · 0.85
SetArgsMethod · 0.80
StringMethod · 0.65
SetOutMethod · 0.45
SetErrMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…