test: ?????????
This commit is contained in:
8
.github/workflows/ci.yaml
vendored
8
.github/workflows/ci.yaml
vendored
@@ -16,9 +16,9 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Set up job
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Set up Terraform (replace with Coder action if possible)
|
- name: Set up Terraform (REPLACE WITH CODER ACTION WHEN DONE)
|
||||||
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
|
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
|
||||||
with:
|
with:
|
||||||
terraform_version: 1.9.8
|
terraform_version: 1.9.8
|
||||||
@@ -29,9 +29,9 @@ jobs:
|
|||||||
bun-version: latest
|
bun-version: latest
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install
|
run: bun install
|
||||||
- name: Verify that Terraform is installed
|
- name: Verify that Terraform is installed (REMOVE WHEN DONE)
|
||||||
run: which terraform
|
run: which terraform
|
||||||
- name: Verify that Node.js is installed
|
- name: Verify that Node.js is installed (REMOVE WHEN DONE)
|
||||||
run: which node
|
run: which node
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: bun test
|
run: bun test
|
||||||
|
|||||||
2
setup.ts
2
setup.ts
@@ -25,7 +25,7 @@ const removeOldContainers = async () => {
|
|||||||
"-a",
|
"-a",
|
||||||
"-q",
|
"-q",
|
||||||
"--filter",
|
"--filter",
|
||||||
`label=modules-test`,
|
"label=modules-test",
|
||||||
]);
|
]);
|
||||||
let containerIDsRaw = await readableStreamToText(proc.stdout);
|
let containerIDsRaw = await readableStreamToText(proc.stdout);
|
||||||
let exitCode = await proc.exited;
|
let exitCode = await proc.exited;
|
||||||
|
|||||||
9
test.ts
9
test.ts
@@ -194,14 +194,19 @@ export const testRequiredVariables = <TVars extends TerraformVariables>(
|
|||||||
export const runTerraformApply = async <TVars extends TerraformVariables>(
|
export const runTerraformApply = async <TVars extends TerraformVariables>(
|
||||||
dir: string,
|
dir: string,
|
||||||
vars: Readonly<TVars>,
|
vars: Readonly<TVars>,
|
||||||
env?: Record<string, string>,
|
customEnv?: Record<string, string>,
|
||||||
): Promise<TerraformState> => {
|
): Promise<TerraformState> => {
|
||||||
const stateFile = `${dir}/${crypto.randomUUID()}.tfstate`;
|
const stateFile = `${dir}/${crypto.randomUUID()}.tfstate`;
|
||||||
|
|
||||||
const combinedEnv = env === undefined ? {} : { ...env };
|
const combinedEnv: Record<string, string | undefined> = {
|
||||||
|
...process.env,
|
||||||
|
...(customEnv ?? {}),
|
||||||
|
};
|
||||||
for (const [key, value] of Object.entries(vars)) {
|
for (const [key, value] of Object.entries(vars)) {
|
||||||
|
if (value !== null) {
|
||||||
combinedEnv[`TF_VAR_${key}`] = String(value);
|
combinedEnv[`TF_VAR_${key}`] = String(value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const proc = spawn(
|
const proc = spawn(
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user