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

Function TestExternalCAOption

cli/command/swarm/opts_test.go:72–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

70}
71
72func TestExternalCAOption(t *testing.T) {
73 testCases := []struct {
74 externalCA string
75 expected string
76 }{
77 {
78 externalCA: "protocol=cfssl,url=anything",
79 expected: "cfssl: anything",
80 },
81 {
82 externalCA: "protocol=CFSSL,url=anything",
83 expected: "cfssl: anything",
84 },
85 {
86 externalCA: "protocol=Cfssl,url=https://example.com",
87 expected: "cfssl: https://example.com",
88 },
89 {
90 externalCA: "protocol=Cfssl,url=https://example.com,foo=bar",
91 expected: "cfssl: https://example.com",
92 },
93 {
94 externalCA: "protocol=Cfssl,url=https://example.com,foo=bar,foo=baz",
95 expected: "cfssl: https://example.com",
96 },
97 }
98 for _, tc := range testCases {
99 opt := &ExternalCAOption{}
100 assert.NilError(t, opt.Set(tc.externalCA))
101 assert.Check(t, is.Equal(tc.expected, opt.String()))
102 }
103}
104
105func TestExternalCAOptionMultiple(t *testing.T) {
106 opt := &ExternalCAOption{}

Callers

nothing calls this directly

Calls 2

SetMethod · 0.95
StringMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…