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

Function TestProviderRawSetEnv

pkg/e2e/providers_test.go:81–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

79}
80
81func TestProviderRawSetEnv(t *testing.T) {
82 provider, err := findExecutable("example-provider")
83 assert.NilError(t, err)
84
85 path := fmt.Sprintf("%s%s%s", os.Getenv("PATH"), string(os.PathListSeparator), filepath.Dir(provider))
86 c := NewParallelCLI(t, WithEnv("PATH="+path))
87 const projectName = "rawsetenv"
88 t.Cleanup(func() {
89 c.cleanupWithDown(t, projectName)
90 })
91
92 res := c.RunDockerComposeCmd(t, "-f", "fixtures/providers/rawsetenv.yaml", "--project-name", projectName, "up")
93 res.Assert(t, icmd.Success)
94 env := getEnv(res.Combined())
95 // setenv: prefixed with service name
96 assert.Check(t, slices.Contains(env, "SECRETS_URL=https://magic.cloud/secrets"), env)
97 // rawsetenv: injected as-is without prefix
98 assert.Check(t, slices.Contains(env, "CLOUD_REGION=us-east-1"), env)
99}
100
101func TestProviderRawSetEnvOverridesUserEnv(t *testing.T) {
102 provider, err := findExecutable("example-provider")

Callers

nothing calls this directly

Calls 7

findExecutableFunction · 0.85
NewParallelCLIFunction · 0.85
WithEnvFunction · 0.85
getEnvFunction · 0.85
cleanupWithDownMethod · 0.80
RunDockerComposeCmdMethod · 0.80
DirMethod · 0.45

Tested by

no test coverage detected