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

Function TestCliPluginsVersion

e2e/cli-plugins/flags_test.go:147–258  ·  view source on GitHub ↗

TestCliPluginsVersion checks that `-v` and friends DTRT

(t *testing.T)

Source from the content-addressed store, hash-verified

145
146// TestCliPluginsVersion checks that `-v` and friends DTRT
147func TestCliPluginsVersion(t *testing.T) {
148 run, _, cleanup := prepare(t)
149 defer cleanup()
150
151 for _, tc := range []struct {
152 name string
153 args []string
154 expCode int
155 expOut, expErr string
156 }{
157 {
158 name: "global-version",
159 args: []string{"version"},
160 expCode: 0,
161 expOut: "Client:\n Version:",
162 expErr: icmd.None,
163 },
164 {
165 name: "global-version-flag",
166 args: []string{"--version"},
167 expCode: 0,
168 expOut: "Docker version",
169 expErr: icmd.None,
170 },
171 {
172 name: "global-short-version-flag",
173 args: []string{"-v"},
174 expCode: 0,
175 expOut: "Docker version",
176 expErr: icmd.None,
177 },
178 {
179 name: "global-with-unknown-arg",
180 args: []string{"version", "foo"},
181 expCode: 1,
182 expOut: icmd.None,
183 expErr: `docker: 'docker version' accepts no arguments`,
184 },
185 {
186 name: "global-with-plugin-arg",
187 args: []string{"version", "helloworld"},
188 expCode: 1,
189 expOut: icmd.None,
190 expErr: `docker: 'docker version' accepts no arguments`,
191 },
192 {
193 name: "global-version-flag-with-unknown-arg",
194 args: []string{"--version", "foo"},
195 expCode: 0,
196 expOut: "Docker version",
197 expErr: icmd.None,
198 },
199 {
200 name: "global-short-version-flag-with-unknown-arg",
201 args: []string{"-v", "foo"},
202 expCode: 0,
203 expOut: "Docker version",
204 expErr: icmd.None,

Callers

nothing calls this directly

Calls 2

prepareFunction · 0.85
runFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…