MCPcopy Create free account
hub / github.com/docker/cli / TestUpdateSwarmSpecCertAndExternalCA

Function TestUpdateSwarmSpecCertAndExternalCA

cli/command/swarm/ca_test.go:239–271  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

237}
238
239func 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
273func TestUpdateSwarmSpecCertAndKeyAndExternalCA(t *testing.T) {
274 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 6

OutBufferMethod · 0.95
writeFileFunction · 0.85
newCACommandFunction · 0.85
SetArgsMethod · 0.80
SetOutMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…