MCPcopy Index your code
hub / github.com/docker/cli / TestLoadWithEnvironment

Function TestLoadWithEnvironment

cli/compose/loader/loader_test.go:509–545  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

507}
508
509func TestLoadWithEnvironment(t *testing.T) {
510 config, err := loadYAMLWithEnv(`
511version: "3"
512services:
513 dict-env:
514 image: busybox
515 environment:
516 FOO: "1"
517 BAR: 2
518 BAZ: 2.5
519 QUX:
520 QUUX:
521 list-env:
522 image: busybox
523 environment:
524 - FOO=1
525 - BAR=2
526 - BAZ=2.5
527 - QUX=
528 - QUUX
529`, map[string]string{"QUX": "qux"})
530 assert.NilError(t, err)
531
532 expected := types.MappingWithEquals{
533 "FOO": strPtr("1"),
534 "BAR": strPtr("2"),
535 "BAZ": strPtr("2.5"),
536 "QUX": strPtr("qux"),
537 "QUUX": nil,
538 }
539
540 assert.Check(t, is.Equal(2, len(config.Services)))
541
542 for _, service := range config.Services {
543 assert.Check(t, is.DeepEqual(expected, service.Environment))
544 }
545}
546
547func TestInvalidEnvironmentValue(t *testing.T) {
548 _, err := loadYAML(`

Callers

nothing calls this directly

Calls 2

loadYAMLWithEnvFunction · 0.85
strPtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…