Skip to content

chore: enable terraform provisioners in e2e by default #13134

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

Merged
merged 24 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PR feedback on executable errors
  • Loading branch information
Emyrk committed May 7, 2024
commit ab2c29ff567331d86c28c6b82a7d13f04d05283d
4 changes: 0 additions & 4 deletions site/e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ export function requiresEnterpriseLicense() {

// requiresTerraform by default is enabled.
export function requiresTerraform() {
if (requireTerraformTests) {
return;
}

test.skip(!requireTerraformTests);
}

Expand Down
48 changes: 31 additions & 17 deletions site/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,37 @@ export const wsEndpoint = process.env.CODER_E2E_WS_ENDPOINT;
// This is where auth cookies are stored!
export const storageState = path.join(__dirname, ".auth.json");

if (requireTerraformTests) {
try {
// If running terraform tests, verify the requirements exist in the
// environment.
//
// These execs will throw an error if the status code is non-zero.
// So if both these work, then we can launch terraform provisioners.
execSync("terraform --version");
execSync("docker --version");
} catch {
throw new Error(
"Terraform provisioners require docker & terraform. " +
"At least one of these is not present in the runtime environment. To check yourself:\n" +
"\t$ terraform --version\n" +
"\t$ docker --version",
);
}
// If running terraform tests, verify the requirements exist in the
// environment.
//
// These execs will throw an error if the status code is non-zero.
// So if both these work, then we can launch terraform provisioners.
let hasTerraform = false;
let hasDocker = false;
try {
execSync("terraform --version");
hasTerraform = true;
} catch {
/* empty */
}

try {
execSync("docker --version");
hasDocker = true;
} catch {
/* empty */
}

if (!hasTerraform || !hasDocker) {
const msg =
"Terraform provisioners require docker & terraform binaries to function. \n" +
(hasTerraform
? ""
: "\tThe `terraform` executable is not present in the runtime environment.\n") +
(hasDocker
? ""
: "\tThe `docker` executable is not present in the runtime environment.\n");
throw new Error(msg);
}

const localURL = (port: number, path: string): string => {
Expand Down
Loading