(t *testing.T)
| 104 | } |
| 105 | |
| 106 | func 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…