(t *testing.T)
| 99 | } |
| 100 | |
| 101 | func TestProviderRawSetEnvOverridesUserEnv(t *testing.T) { |
| 102 | provider, err := findExecutable("example-provider") |
| 103 | assert.NilError(t, err) |
| 104 | |
| 105 | path := fmt.Sprintf("%s%s%s", os.Getenv("PATH"), string(os.PathListSeparator), filepath.Dir(provider)) |
| 106 | c := NewParallelCLI(t, WithEnv("PATH="+path)) |
| 107 | const projectName = "rawsetenv-override" |
| 108 | t.Cleanup(func() { |
| 109 | c.cleanupWithDown(t, projectName) |
| 110 | }) |
| 111 | |
| 112 | res := c.RunDockerComposeCmd(t, "-f", "fixtures/providers/rawsetenv-override.yaml", "--project-name", projectName, "up") |
| 113 | res.Assert(t, icmd.Success) |
| 114 | env := getEnv(res.Combined()) |
| 115 | // rawsetenv overrides a user-defined environment variable |
| 116 | assert.Check(t, slices.Contains(env, "CLOUD_REGION=us-east-1"), env) |
| 117 | assert.Check(t, !slices.Contains(env, "CLOUD_REGION=user-defined-region"), env) |
| 118 | // the override is surfaced to the user rather than happening silently |
| 119 | assert.Check(t, strings.Contains(res.Combined(), "overrides environment variable"), res.Combined()) |
| 120 | } |
| 121 | |
| 122 | func TestProviderRawSetEnvOverridesInheritedEnv(t *testing.T) { |
| 123 | provider, err := findExecutable("example-provider") |
nothing calls this directly
no test coverage detected