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

Function TestHasBuilderName

cmd/docker/builder_test.go:253–296  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

251}
252
253func TestHasBuilderName(t *testing.T) {
254 cases := []struct {
255 name string
256 args []string
257 envs []string
258 expected bool
259 }{
260 {
261 name: "no args",
262 args: []string{"docker", "build", "."},
263 envs: []string{"FOO=bar"},
264 expected: false,
265 },
266 {
267 name: "env var",
268 args: []string{"docker", "build", "."},
269 envs: []string{"BUILDX_BUILDER=foo"},
270 expected: true,
271 },
272 {
273 name: "empty env var",
274 args: []string{"docker", "build", "."},
275 envs: []string{"BUILDX_BUILDER="},
276 expected: false,
277 },
278 {
279 name: "flag",
280 args: []string{"docker", "build", "--builder", "foo", "."},
281 envs: []string{"FOO=bar"},
282 expected: true,
283 },
284 {
285 name: "both",
286 args: []string{"docker", "build", "--builder", "foo", "."},
287 envs: []string{"BUILDX_BUILDER=foo"},
288 expected: true,
289 },
290 }
291 for _, tc := range cases {
292 t.Run(tc.name, func(t *testing.T) {
293 assert.Equal(t, tc.expected, hasBuilderName(tc.args, tc.envs))
294 })
295 }
296}

Callers

nothing calls this directly

Calls 1

hasBuilderNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…