MCPcopy
hub / github.com/docker/compose / TestResolveAppID_ShortCircuitsOnFlag

Function TestResolveAppID_ShortCircuitsOnFlag

cmd/compose/hooks_test.go:252–273  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

250}
251
252func TestResolveAppID_ShortCircuitsOnFlag(t *testing.T) {
253 tests := []struct {
254 name string
255 flags map[string]string
256 }{
257 {name: "long --project-name", flags: map[string]string{"project-name": ""}},
258 {name: "short -p", flags: map[string]string{"p": ""}},
259 {name: "long --file", flags: map[string]string{"file": ""}},
260 {name: "short -f", flags: map[string]string{"f": ""}},
261 {name: "long --project-directory", flags: map[string]string{"project-directory": ""}},
262 {name: "deprecated --workdir alias", flags: map[string]string{"workdir": ""}},
263 {name: "long --env-file", flags: map[string]string{"env-file": ""}},
264 }
265 for _, tt := range tests {
266 t.Run(tt.name, func(t *testing.T) {
267 // Use a real tmpdir as workDir so the short-circuit path is
268 // exercised independently of the loader's file discovery.
269 got := resolveAppIDIn(t.Context(), tt.flags, t.TempDir())
270 assert.Equal(t, got, "")
271 })
272 }
273}
274
275func TestResolveAppID_NameFromComposeFile(t *testing.T) {
276 dir := t.TempDir()

Callers

nothing calls this directly

Calls 2

resolveAppIDInFunction · 0.85
TempDirMethod · 0.80

Tested by

no test coverage detected