(t *testing.T)
| 237 | } |
| 238 | |
| 239 | func TestUpdateSwarmSpecCertAndExternalCA(t *testing.T) { |
| 240 | tmpDir := t.TempDir() |
| 241 | certFile, err := writeFile(tmpDir, cert) |
| 242 | assert.NilError(t, err) |
| 243 | |
| 244 | s := &swarmUpdateRecorder{} |
| 245 | cli := test.NewFakeCli(&fakeClient{ |
| 246 | swarmInspectFunc: swarmInspectFuncWithFullCAConfig, |
| 247 | swarmUpdateFunc: s.swarmUpdate, |
| 248 | }) |
| 249 | cmd := newCACommand(cli) |
| 250 | cmd.SetArgs([]string{ |
| 251 | "--rotate", |
| 252 | "--detach", |
| 253 | "--ca-cert=" + certFile, |
| 254 | "--external-ca=protocol=cfssl,url=https://some.external.ca.example.com", |
| 255 | }) |
| 256 | cmd.SetOut(cli.OutBuffer()) |
| 257 | assert.NilError(t, cmd.Execute()) |
| 258 | |
| 259 | expected := swarmSpecWithFullCAConfig() |
| 260 | expected.CAConfig.SigningCACert = cert |
| 261 | expected.CAConfig.SigningCAKey = "" |
| 262 | expected.CAConfig.ExternalCAs = []*swarm.ExternalCA{ |
| 263 | { |
| 264 | Protocol: swarm.ExternalCAProtocolCFSSL, |
| 265 | URL: "https://some.external.ca.example.com", |
| 266 | CACert: cert, |
| 267 | Options: make(map[string]string), |
| 268 | }, |
| 269 | } |
| 270 | assert.Check(t, is.DeepEqual(*expected, s.spec)) |
| 271 | } |
| 272 | |
| 273 | func TestUpdateSwarmSpecCertAndKeyAndExternalCA(t *testing.T) { |
| 274 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected
searching dependent graphs…