From df53f969510988d7cd1473d5a5923f93254e3e33 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Mon, 27 Jan 2025 20:28:14 +0000 Subject: [PATCH] test: ????????? --- .github/workflows/ci.yaml | 8 ++++---- setup.ts | 2 +- test.ts | 11 ++++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 81fbe4f..82cd741 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,9 +16,9 @@ jobs: test: runs-on: ubuntu-latest steps: - - name: Set up job + - name: Check out code 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 with: terraform_version: 1.9.8 @@ -29,9 +29,9 @@ jobs: bun-version: latest - name: Install dependencies run: bun install - - name: Verify that Terraform is installed + - name: Verify that Terraform is installed (REMOVE WHEN DONE) run: which terraform - - name: Verify that Node.js is installed + - name: Verify that Node.js is installed (REMOVE WHEN DONE) run: which node - name: Run tests run: bun test diff --git a/setup.ts b/setup.ts index 3cfb871..a867c75 100644 --- a/setup.ts +++ b/setup.ts @@ -25,7 +25,7 @@ const removeOldContainers = async () => { "-a", "-q", "--filter", - `label=modules-test`, + "label=modules-test", ]); let containerIDsRaw = await readableStreamToText(proc.stdout); let exitCode = await proc.exited; diff --git a/test.ts b/test.ts index 5437374..6b945c6 100644 --- a/test.ts +++ b/test.ts @@ -194,13 +194,18 @@ export const testRequiredVariables = ( export const runTerraformApply = async ( dir: string, vars: Readonly, - env?: Record, + customEnv?: Record, ): Promise => { const stateFile = `${dir}/${crypto.randomUUID()}.tfstate`; - const combinedEnv = env === undefined ? {} : { ...env }; + const combinedEnv: Record = { + ...process.env, + ...(customEnv ?? {}), + }; for (const [key, value] of Object.entries(vars)) { - combinedEnv[`TF_VAR_${key}`] = String(value); + if (value !== null) { + combinedEnv[`TF_VAR_${key}`] = String(value); + } } const proc = spawn(