Skip to content

Commit

Permalink
ci: make errors thrown in e2e seed utility throw errors in the pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-Digital committed Feb 16, 2025
1 parent fdafff9 commit c2a3a54
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/e2e-seed-data-framework/connections.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export async function checkConnections() {
await reportDb.authenticate();
} catch (error) {
console.error("Unable to establish connection to the database:", error);
process.exit(1);
}

console.log("Connections are OK!");
Expand All @@ -51,6 +52,7 @@ export async function closeConnections() {
await reportDb.close();
} catch (error) {
console.error("Unable to close connection to the database:", error);
process.exit(1);
}

console.log("Connections Closed!");
Expand Down
4 changes: 4 additions & 0 deletions test/e2e-seed-data-framework/scripts/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ if (process.env.EXAMPLE_SEED.toUpperCase() === "TRUE") {

await checkConnections();

let succeeded = true;

try {
await setup();
} catch (error) {
console.error("Unable to run setup:", error);
succeeded = false;
} finally {
await closeConnections();
if (!succeeded) process.exit(1);
}

/**
Expand Down
4 changes: 4 additions & 0 deletions test/e2e-seed-data-framework/scripts/teardown.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ await checkConnections();

const baseId = parseInt(process.env.IDS_START_FROM);

let succeeded = true;

try {
await teardown();
} catch (error) {
console.error("Unable to run teardown:", error);
succeeded = false;
} finally {
await closeConnections();
if (!succeeded) process.exit(1);
}

async function teardown() {
Expand Down

0 comments on commit c2a3a54

Please # to comment.