From 7e8939f83ab39255cff187d8f3c3ecf42eb59afb Mon Sep 17 00:00:00 2001 From: exaby73 Date: Thu, 31 Oct 2024 18:08:26 +0530 Subject: [PATCH] fix(integration_test): Use bash for source command --- cloudbuild.yaml | 9 ++++++--- integration_test/setup.ts | 11 +++-------- integration_test/tests/utils.ts | 7 ++++--- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index b86f7b8a7..3a7d278c0 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -1,15 +1,18 @@ steps: - name: "node:18" - entrypoint: "npm" + id: "Install dependencies" dir: "integration_test" + entrypoint: "npm" args: ["install"] - name: "node:18" - entrypoint: "npx" + id: "Set Project ID" dir: "integration_test" + entrypoint: "npx" args: ["firebase", "use", "cf3-integration-tests-d7be6"] - name: "node:18" - entrypoint: "npm" + id: "Run tests" dir: "integration_test" + entrypoint: "npm" args: ["start"] options: diff --git a/integration_test/setup.ts b/integration_test/setup.ts index a00417f98..94f446ff3 100644 --- a/integration_test/setup.ts +++ b/integration_test/setup.ts @@ -81,11 +81,12 @@ function buildPythonSdk() { execSync( "source venv/bin/activate && python -m pip install --upgrade build", - { stdio: "inherit" } + { stdio: "inherit", shell: "bash" } ); execSync("source venv/bin/activate && python -m build -s", { stdio: "inherit", + shell: "bash", }); // move the generated tarball package to functions @@ -97,13 +98,7 @@ function buildPythonSdk() { .find((file) => file.match(/^firebase_functions-.*\.tar\.gz$/)); if (generatedFile) { - const targetPath = path.join( - "integration_tests", - - "functions", - - `firebase_functions.tar.gz` - ); + const targetPath = path.join("integration_tests", "functions", `firebase_functions.tar.gz`); fs.renameSync(path.join("dist", generatedFile), targetPath); diff --git a/integration_test/tests/utils.ts b/integration_test/tests/utils.ts index 19f695116..b807d181f 100644 --- a/integration_test/tests/utils.ts +++ b/integration_test/tests/utils.ts @@ -114,7 +114,7 @@ export async function createTask( payload: Record ) { const client = new CloudTasksClient(); - const queuePath = client.queuePath(project, location, queue); + // const queuePath = client.queuePath(project, location, queue); // try { // await client.getQueue({ name: queuePath }); // } catch (err: any) { @@ -169,10 +169,11 @@ export async function retry(fn: () => Promise, options?: RetryOptions): Pr let count = 0; let lastError: Error | undefined; const { maxRetries = 20, checkForUndefined = true } = options ?? {}; + let result: Awaited | null = null; while (count < maxRetries) { try { - const result = await fn(); + result = await fn(); if (!checkForUndefined || result) { return result; } @@ -187,5 +188,5 @@ export async function retry(fn: () => Promise, options?: RetryOptions): Pr throw lastError; } - throw new Error("Max retries exceeded"); + throw new Error(`Max retries exceeded: result = ${result}`); }