Skip to content

Automated tests fail with message Executable not found in $PATH: "terraform" #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Parkreiner opened this issue Jan 27, 2025 · 1 comment · Fixed by #390
Closed

Automated tests fail with message Executable not found in $PATH: "terraform" #389

Parkreiner opened this issue Jan 27, 2025 · 1 comment · Fixed by #390
Assignees

Comments

@Parkreiner
Copy link
Member

Making an issue for tracking purposes, but I'm also starting on this right now.

Problem

When running automated tests in CI, the test job fails. The error message says that +90% of the tests could not succeed because of Terraform is missing from $PATH.

Error: 
        at <anonymous> (/home/runner/work/modules/modules/test.ts:206:16)
        at runTerraformApply (/home/runner/work/modules/modules/test.ts:1[9](https://github.com/coder/modules/actions/runs/12982917241/job/36206463110?pr=388#step:6:10)5:3)
        at <anonymous> (/home/runner/work/modules/modules/test.ts:158:11)
        at <anonymous> (/home/runner/work/modules/modules/test.ts:157:28)
  201 |   const combinedEnv = env === undefined ? {} : { ...env };
  202 |   for (const [key, value] of Object.entries(vars)) {
  203 |     combinedEnv[`TF_VAR_${key}`] = String(value);
  204 |   }
  205 | 
  206 |   const proc = spawn(
                       ^
  error: Executable not found in $PATH: "terraform"
   path: "terraform",
   code: "ENOENT"
  
        at <anonymous> (/home/runner/work/modules/modules/test.ts:206:16)
        at runTerraformApply (/home/runner/work/modules/modules/test.ts:195:3)
        at <anonymous> (/home/runner/work/modules/modules/test.ts:158:[11](https://github.com/coder/modules/actions/runs/12982917241/job/36206463110?pr=388#step:6:12))
        at <anonymous> (/home/runner/work/modules/modules/test.ts:157:28)
  (fail) git-clone > required variables [1.00ms]
  
  Error: Expected to contain: "input variable \"agent_id\" is not set"

The above is basically repeated across all the tests that rely on spawn and Terraform

 3 pass
 146 fail
 41 expect() calls
Ran 149 tests across 28 files. [14.22s]

Links

Notes

  • Looking at the job history, it seems like CI only really started to break in the past three weeks. I'm going to see if there was some kind of change that might've broken things
@bcpeinhardt
Copy link
Collaborator

It looks like bun updated how the environment gets propagated through a spawn call: https://github.com/oven-sh/bun/pull/16067, might be why we're no longer seeing Terraform in the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants