Skip to content

Commit c3822ea

Browse files
committed
fix: make sure TF tests run properly
1 parent 8480748 commit c3822ea

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ export const runTerraformApply = async <TVars extends TerraformVariables>(
202202
...process.env,
203203
...(customEnv ?? {}),
204204
};
205+
206+
// This is a fix for when you try to run the tests from a Coder workspace.
207+
// When process.env is destructured into the object, it can sometimes have
208+
// workspace-specific values, which causes the resulting URL to be different
209+
// from what the tests have classically expected.
210+
childEnv.CODER_AGENT_URL = undefined;
211+
childEnv.CODER_WORKSPACE_NAME = undefined;
212+
205213
for (const [key, value] of Object.entries(vars) as [string, JsonValue][]) {
206214
if (value !== null) {
207215
childEnv[`TF_VAR_${key}`] = String(value);

0 commit comments

Comments
 (0)