Skip to content

Commit

Permalink
[TM-1452] Workaround for test DB setup failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
roguenet committed Nov 20, 2024
1 parent 40ede90 commit 6919459
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions setup-jest.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
import { Sequelize } from 'sequelize-typescript';
import { FactoryGirl, SequelizeAdapter } from 'factory-girl-ts';
import * as Entities from '@terramatch-microservices/database/entities';
import { Sequelize } from "sequelize-typescript";
import { FactoryGirl, SequelizeAdapter } from "factory-girl-ts";
import * as Entities from "@terramatch-microservices/database/entities";

let sequelize: Sequelize;

beforeAll(async () => {
// To create this database, run the ./setup-test-database.sh script.
sequelize = new Sequelize({
dialect: 'mariadb',
host: 'localhost',
dialect: "mariadb",
host: "localhost",
port: 3360,
username: 'wri',
password: 'wri',
database: 'terramatch_microservices_test',
username: "wri",
password: "wri",
database: "terramatch_microservices_test",
models: Object.values(Entities),
logging: false,
})
logging: false
});

await sequelize.sync();
try {
await sequelize.sync();
} catch (e) {
// We can ignore this in most cases because it probably means another task has already synced
// the DB
console.info("Error Synchronizing DB Schema", e);
}
FactoryGirl.setAdapter(new SequelizeAdapter());
});

Expand Down

0 comments on commit 6919459

Please sign in to comment.