Skip to content

Commit

Permalink
fix node js tests consistently failing (#1861)
Browse files Browse the repository at this point in the history
  • Loading branch information
lolopinto authored Nov 30, 2024
1 parent e2a449c commit 8edd300
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 46 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
env:
POSTGRES_PASSWORD: postgres
name: 'PGOPTIONS'
value: '-c max_connections=1000'
value: '-c max_connections=200'
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm test -- --runInBand
env:
POSTGRES_PASSWORD: 'postgres'
POSTGRES_USER: 'postgres'
2 changes: 1 addition & 1 deletion examples/simple/src/ent/tests/user_full_text.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ beforeAll(async () => {
password,
port: 5432,
sslmode: "disable",
max: 100,
max: 200,
},
// log: ["query"],
});
Expand Down
38 changes: 20 additions & 18 deletions ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@swc/core": "^1.3.100",
"@swc/jest": "^0.2.26",
"@types/bcryptjs": "^2.4.2",
"@types/better-sqlite3": "^7.6.4",
"@types/better-sqlite3": "^7.6.12",
"@types/express": "^4.17.15",
"@types/glob": "^8.0.0",
"@types/graphql-upload": "^8.0.12",
Expand All @@ -64,7 +64,7 @@
"@types/pluralize": "0.0.29",
"@types/supertest": "^2.0.12",
"@types/uuid": "^9.0.0",
"better-sqlite3": "^8.4.0",
"better-sqlite3": "^11.6.0",
"email-addresses": "^5.0.0",
"express": "^4.18.2",
"graphql": "^16.8.1",
Expand Down
43 changes: 22 additions & 21 deletions ts/src/action/orchestrator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,6 @@ import { randomEmail } from "../testutils/db/value";
import { toDBColumnOrTable } from "../names/names";

const edges = ["edge", "inverseEdge", "symmetricEdge"];
beforeEach(async () => {
// does assoc_edge_config loader need to be cleared?
for (const edge of edges) {
await createRowForTest({
tableName: "assoc_edge_config",
fields: {
edge_table: toDBColumnOrTable(edge, "table"),
symmetric_edge: edge == "symmetricEdge",
inverse_edge_type: edge === "edge" ? "inverseEdge" : "edge",
edge_type: edge,
edge_name: "name",
created_at: new Date(),
updated_at: new Date(),
},
});
}
});

afterEach(() => {
FakeComms.clear();
});

const UserSchema = getBuilderSchemaFromFields(
{
Expand Down Expand Up @@ -526,6 +505,28 @@ function getInsertUserBuilder(
}

function commonTests() {
beforeAll(async () => {
// does assoc_edge_config loader need to be cleared?
for (const edge of edges) {
await createRowForTest({
tableName: "assoc_edge_config",
fields: {
edge_table: toDBColumnOrTable(edge, "table"),
symmetric_edge: edge == "symmetricEdge",
inverse_edge_type: edge === "edge" ? "inverseEdge" : "edge",
edge_type: edge,
edge_name: "name",
created_at: new Date(),
updated_at: new Date(),
},
});
}
});

afterEach(() => {
FakeComms.clear();
});

test("schema on create", async () => {
const builder = getInsertUserBuilder(
new Map([
Expand Down
2 changes: 1 addition & 1 deletion ts/src/core/db_postgres_parallel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test("lots of writes at once", async () => {
user,
password,
database: tdb.getDB(),
max: 1000,
max: 200,
host: "localhost",
},
});
Expand Down
2 changes: 1 addition & 1 deletion ts/src/testutils/db/temp_db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ export class TempDB {
DB.initDB({
connectionString: connStr,
cfg: {
max: 100,
max: 200,
idleTimeoutMillis: 100,
},
});
Expand Down

0 comments on commit 8edd300

Please sign in to comment.