Skip to content

Commit

Permalink
fix(integration_test): Use bash for source command
Browse files Browse the repository at this point in the history
  • Loading branch information
exaby73 committed Oct 31, 2024
1 parent 571f3fc commit 7e8939f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
9 changes: 6 additions & 3 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
11 changes: 3 additions & 8 deletions integration_test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand Down
7 changes: 4 additions & 3 deletions integration_test/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export async function createTask(
payload: Record<string, any>
) {
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) {
Expand Down Expand Up @@ -169,10 +169,11 @@ export async function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Pr
let count = 0;
let lastError: Error | undefined;
const { maxRetries = 20, checkForUndefined = true } = options ?? {};
let result: Awaited<T> | null = null;

while (count < maxRetries) {
try {
const result = await fn();
result = await fn();
if (!checkForUndefined || result) {
return result;
}
Expand All @@ -187,5 +188,5 @@ export async function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Pr
throw lastError;
}

throw new Error("Max retries exceeded");
throw new Error(`Max retries exceeded: result = ${result}`);
}

0 comments on commit 7e8939f

Please sign in to comment.