Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batched job processing (opt-in) #474

Open
wants to merge 149 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
1237c23
Start work on batch fetching jobs
benjie Jun 6, 2024
c356e0a
Batched job fetching with watermark
benjie Jun 6, 2024
9781bdc
Fix getJob call to reflect changes in #469
benjie Jun 6, 2024
892733f
Hoist completeJob and failJob
benjie Jun 6, 2024
e4782d1
Refactor failJob/completeJob in preparation for batching
benjie Jun 6, 2024
2dacae8
Stub batch function
benjie Jun 6, 2024
080b674
Implement batching function
benjie Jun 6, 2024
79eee2d
Lint fix
benjie Jun 6, 2024
3586553
Tweak graceful/forceful shutdown handover
benjie Jun 6, 2024
a4acb7e
Evaluate envvar just once up top
benjie Jun 6, 2024
aa58a94
Release batches before releasing worker pool
benjie Jun 6, 2024
c1c4c8f
Tweak perfTest for more logging
benjie Jun 6, 2024
f201f60
Fairer startup time calc
benjie Jun 6, 2024
ea6ae05
Refactor
benjie Jun 6, 2024
070de02
Warn about bad batch settings
benjie Jun 10, 2024
772962e
Refactor in preparation for new queue
benjie Jun 10, 2024
2f0a54f
Refactor again and explain the purpose of LocalQueue and how it works
benjie Jun 10, 2024
c0592c9
Implement localQueue
benjie Jun 10, 2024
c2077d9
Return to POLLING from WAITING; RELEASE mode.
benjie Jun 11, 2024
6d26ee3
Once only once.
benjie Jun 11, 2024
b520cde
Fix releasing from POLLING mode
benjie Jun 11, 2024
5f96eac
Concurrency 24 works better on my new machine
benjie Jun 11, 2024
42ed1b1
Wait for background tasks to complete before releasing
benjie Jun 11, 2024
f6890ee
Enable ts-check on graphile.config.js
benjie Jun 11, 2024
96e8f36
Add types to latencyTest file
benjie Jun 11, 2024
963f5bc
Default settings
benjie Jun 11, 2024
7db8081
Remove double map
benjie Jun 11, 2024
0f777b6
More efficient implementation
benjie Jun 11, 2024
b3e7177
Neater API
benjie Jun 11, 2024
38f4b02
Marginally more efficient
benjie Jun 11, 2024
470940d
Need to test more jobs because we're too fast now
benjie Jun 11, 2024
5182ba5
Boolean comparison first
benjie Jun 11, 2024
f6727a5
Single job different statement, plus disabled alternative approach
benjie Jun 11, 2024
349348f
Listen with new LocalQueue too
benjie Jun 11, 2024
3f5eb76
Load preset into latencyTest
benjie Jun 11, 2024
81063d9
Remove TS config, it's confusing
benjie Jun 11, 2024
b70117c
Lint fixes
benjie Jun 11, 2024
6c2c85c
Oops
benjie Jun 11, 2024
45325d7
0.17.0-canary.6c2c85c
benjie Jul 12, 2024
67dbcb6
Rejection reason might be nullish
benjie Oct 16, 2024
baa4b59
0.17.0-canary.67dbcb6
benjie Oct 16, 2024
b298e60
JobCount in tests has race condition
benjie Oct 18, 2024
f17dcb9
Run the tests in their own database in parallel
benjie Oct 18, 2024
bcaecf3
Lint
benjie Oct 18, 2024
74b6c80
Fix CI setup
benjie Oct 18, 2024
667a8f7
[ci] bump
benjie Oct 18, 2024
49c4e35
[ci] bump
benjie Oct 18, 2024
9cf07ea
[ci] bump
benjie Oct 18, 2024
3c78ca0
Bump timeout
benjie Oct 18, 2024
05a09e7
[ci] bump
benjie Oct 18, 2024
a0553da
[ci] bump
benjie Oct 18, 2024
bfcbdbf
[ci] bump
benjie Oct 18, 2024
2ae36a1
Solve race condition in another place
benjie Oct 18, 2024
c8dbf2a
Use TypeScript to prevent us accidentally using jobCount with pool
benjie Oct 18, 2024
d7271f5
[ci] bump
benjie Oct 18, 2024
6d5230f
[ci] bump
benjie Oct 18, 2024
81b0050
[ci] bump
benjie Oct 18, 2024
8efd928
Update src/localQueue.ts
benjie Oct 30, 2024
0cd5135
Move localQueue options into their own object
benjie Oct 25, 2024
16c63bf
Introduce STARTING mode
benjie Oct 25, 2024
31c2e18
Add localQueue refetchDelay feature: be kind on DB when queue is near…
benjie Oct 25, 2024
20a581f
Randomize the abort threshold
benjie Oct 25, 2024
d4df163
Cleaner branching without setting fetchAgain by accident
benjie Oct 25, 2024
2ff4688
Lint
benjie Nov 1, 2024
d18ff7b
Don't trigger refetch once setting mode to released
benjie Nov 11, 2024
77f09af
Fix bug and clarify variable name
benjie Nov 11, 2024
95c8cc2
Comments and variable renames for clarity
benjie Nov 11, 2024
a90f9bc
Clarify and fix behavior of refetch delay
benjie Nov 13, 2024
d5f35df
Reduce diff
benjie Nov 13, 2024
b4cc99f
Reduce DB load on near-empty jobs table with frequent add_job (#500)
benjie Nov 13, 2024
b869f5d
Merge branch 'main' into pool-centric
benjie Nov 13, 2024
1b8eb2e
Fix test helpers
benjie Nov 13, 2024
12854d5
Merge branch 'main' into pool-centric
benjie Nov 13, 2024
272aa4d
Revert change
benjie Nov 13, 2024
379fb2e
Merge branch 'main' into pool-centric
benjie Nov 13, 2024
b3ed0b0
0.17.0-canary.379fb2e
benjie Nov 13, 2024
0ef7d7f
Update performance results
benjie Nov 14, 2024
ac7e622
Beginnings of tower defence
benjie Nov 14, 2024
3c81f81
More waves and don't wait between waves
benjie Nov 14, 2024
82d5194
Add some events so we can collect stats from tower defence
benjie Nov 14, 2024
5cde9c3
Easier to read results
benjie Nov 14, 2024
ffd44ad
Extreme values demonstrate problem
benjie Nov 14, 2024
1101e54
Produce the problematic behavior I was worried about
benjie Nov 14, 2024
0e21b2a
Clarify doc
benjie Nov 14, 2024
62d1601
Rename abortThreshold to maxAbortThreshold and update docs and implem…
benjie Nov 15, 2024
770a3d5
More waves
benjie Nov 15, 2024
c1b62df
Shorter waves
benjie Nov 15, 2024
6d66dbc
Ive we've already been running jobs slowly, don't sleep so long
benjie Nov 15, 2024
0bfcc09
This isn't an error
benjie Nov 15, 2024
7ad9bc6
Tweak more log levels
benjie Nov 15, 2024
9c676c3
Track empty fetches
benjie Nov 15, 2024
a699102
Merge branch 'main' into pool-centric
benjie Nov 15, 2024
a3016f5
Use addJobs API and track latency
benjie Nov 15, 2024
eb6e0cc
Can't delete DB if workerUtils is connected
benjie Nov 15, 2024
51af5e1
Stupid mistake
benjie Nov 15, 2024
fd28f21
Fix division by zero error
benjie Nov 15, 2024
f70c27e
Add another wave, and increase local queue size by 1
benjie Nov 15, 2024
6aeb577
Use JSON rather than constructing tuples; batch at 1M
benjie Nov 15, 2024
fd8a165
0.17.0-canary.6aeb577
benjie Nov 15, 2024
0c86315
Make error handling more explicit, and warn user if they haven't
benjie Nov 15, 2024
921b4fe
Note in release notes
benjie Nov 15, 2024
a7a7778
Minimize diff
benjie Nov 15, 2024
2b16219
Minimize diff
benjie Nov 15, 2024
9817f67
Merge branch 'main' into pool-centric
benjie Nov 15, 2024
73fc7c7
0.17.0-canary.9817f67
benjie Nov 15, 2024
c558061
"Breaking" change
benjie Nov 18, 2024
873b115
Fix migration tests
benjie Nov 18, 2024
c8caef0
Install error handlers into temp pools
benjie Nov 18, 2024
3337548
Include version in error message; assert 'connect' handler too
benjie Nov 18, 2024
c8e3ffe
Assert all migrations pass
benjie Nov 18, 2024
4c816d5
Ignore pro
benjie Nov 18, 2024
8757da4
Use Node18 preset for TypeScript
benjie Nov 18, 2024
45db25a
Fix all the issues from TypeScript strict mode
benjie Nov 18, 2024
716cc3c
Fix typescript issue
benjie Nov 18, 2024
151a7c1
Move release of batching of fail/complete to terminate
benjie Nov 18, 2024
d6a76be
Don't log success messages when running tests
benjie Nov 18, 2024
117bbf3
Don't log connection message when NO_LOG_SUCCESS is enabled
benjie Nov 18, 2024
7d50317
Convert release to async function
benjie Nov 18, 2024
5907fc0
Add a test to ensure runOnce actually runs the jobs
benjie Nov 18, 2024
89813a5
Fix the syntax makeSelectionOfJobs
benjie Nov 18, 2024
64fd62c
Upgrade jest time helpers so sleep is unref'd
benjie Nov 18, 2024
8a2bb75
Test that graceful shutdown works in runOnce
benjie Nov 18, 2024
5e64200
Test gracefulShutdown of run
benjie Nov 18, 2024
2055211
Fix runOnce test
benjie Nov 18, 2024
003ef81
Upgrade graphile-config
benjie Nov 19, 2024
9f52007
Implement middleware system
benjie Nov 19, 2024
b453de2
Fix types for makeJobHelpers
benjie Nov 19, 2024
5ebd5d3
gracefulShutdown middleware
benjie Nov 19, 2024
e5810bf
Shutting down non-continuous worker should go via gracefulShutdown path
benjie Nov 19, 2024
a5e690f
f
benjie Nov 19, 2024
e23a214
Add middleware for forcefulShutdown, guarantee event emitter, rework …
benjie Nov 19, 2024
0d525b9
Clarify relationship between CompiledSharedOptions and WorkerPluginCo…
benjie Nov 19, 2024
5190bb6
Fix lint issues
benjie Nov 19, 2024
b6b1bc0
Only shutdown if we're not already doing so
benjie Nov 19, 2024
407e169
Fix onTerminate handling
benjie Nov 20, 2024
6ccbbfb
Forceful shutdown should error if something went wrong
benjie Nov 20, 2024
d3edcb4
Forceful shutdown should result in promise rejection
benjie Nov 20, 2024
ef1f7cf
Refactoring to ensure all cases are handled
benjie Nov 20, 2024
03d1dee
We don't release job releasers here any more.
benjie Nov 20, 2024
bfb7c36
Ensure that LocalQueue exits with the correct status (e.g. rejects if…
benjie Nov 20, 2024
e76b3af
Fix types in a test
benjie Nov 20, 2024
17bea7c
I threw it myself, I know what it is
benjie Nov 20, 2024
ae310f5
Ensure deactivate happens at most once, and yields same errors if cal…
benjie Nov 20, 2024
13740a4
Ensure forcefulShutdown and gracefulShutdown yield the same promises …
benjie Nov 20, 2024
128f52e
Graceful shutdown should not complete if forceful shutdown has begun
benjie Nov 20, 2024
7a8f872
Cleanup gracefulShutdown handover to forcefulShutdown
benjie Nov 20, 2024
d14f3bf
More consistently handle errors in forcefulShutdown
benjie Nov 20, 2024
48ac9ea
Move promise handling outside of the gracefulShutdown/forcefulShutdow…
benjie Nov 20, 2024
6f392f3
Only finish once
benjie Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- run: yarn node --experimental-vm-modules node_modules/.bin/jest -i --ci
- run: yarn prepack
- run: yarn test:setupdb
- run: yarn test:only --ci

lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -89,8 +91,9 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
# - run: yarn lint # No need to lint altschema
- run: yarn node --experimental-vm-modules node_modules/.bin/jest -i --ci
- run: yarn prepack
- run: yarn test:setupdb
- run: yarn test:only --ci

database_updated:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.git
dist
npm-debug.log*
yarn-debug.log*
Expand Down
4 changes: 2 additions & 2 deletions __tests__/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import deferred, { Deferred } from "../src/deferred";
import { Task, TaskList, WorkerSharedOptions } from "../src/interfaces";
import {
ESCAPED_GRAPHILE_WORKER_SCHEMA,
jobCount,
expectJobCount,
reset,
sleep,
sleepUntil,
Expand Down Expand Up @@ -132,7 +132,7 @@ test("emits the expected events", () =>
expect(eventCount("worker:release")).toEqual(CONCURRENCY);
expect(eventCount("worker:stop")).toEqual(CONCURRENCY);
expect(eventCount("pool:release")).toEqual(1);
expect(await jobCount(pgPool)).toEqual(0);
await expectJobCount(pgPool, 0);
} finally {
Object.values(jobPromises).forEach((p) => p?.resolve());
}
Expand Down
10 changes: 2 additions & 8 deletions __tests__/forbiddenFlags.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@ import {
TaskList,
WorkerSharedOptions,
} from "../src/index";
import {
getJobs,
reset,
TEST_CONNECTION_STRING,
withPgClient,
withPgPool,
} from "./helpers";
import { getJobs, reset, withPgClient, withPgPool } from "./helpers";

const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

const options: WorkerSharedOptions = {};

test("supports the flags API", () =>
withPgClient(async (pgClient) => {
withPgClient(async (pgClient, { TEST_CONNECTION_STRING }) => {
await reset(pgClient, options);

// Schedule a job
Expand Down
104 changes: 93 additions & 11 deletions __tests__/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { randomBytes } from "crypto";
import { EventEmitter } from "events";
import { sleep, sleepUntil as baseSleepUntil } from "jest-time-helpers";
import * as pg from "pg";
import { parse } from "pg-connection-string";

import defer from "../src/deferred";
import {
Expand Down Expand Up @@ -32,23 +33,62 @@ export {
SECOND,
setupFakeTimers,
sleep,
sleepUntil,
WEEK,
} from "jest-time-helpers";

export function sleepUntil(condition: () => boolean, ms?: number) {
// Bump the default timeout from 2000ms for CI
return baseSleepUntil(condition, ms ?? 5000);
}

// Sometimes CI's clock can get interrupted (it is shared infra!) so this
// extends the default timeout just in case.
jest.setTimeout(15000);
jest.setTimeout(20000);

// process.env.GRAPHILE_LOGGER_DEBUG = "1";

export const TEST_CONNECTION_STRING =
process.env.TEST_CONNECTION_STRING || "postgres:///graphile_worker_test";
async function createTestDatabase() {
const id = randomBytes(8).toString("hex");
const PGDATABASE = `graphile_worker_test_${id}`;
{
const client = new pg.Client({ connectionString: `postgres:///template1` });
await client.connect();
await client.query(
`create database ${pg.Client.prototype.escapeIdentifier(
PGDATABASE,
)} with template = graphile_worker_testtemplate;`,
);
await client.end();
}
const TEST_CONNECTION_STRING = `postgres:///${PGDATABASE}`;
const PGHOST = process.env.PGHOST;
async function release() {
const client = new pg.Client({ connectionString: `postgres:///template1` });
await client.connect();
await client.query(
`drop database ${pg.Client.prototype.escapeIdentifier(PGDATABASE)};`,
);
await client.end();
}

return {
TEST_CONNECTION_STRING,
PGHOST,
PGDATABASE,
release,
};
}

const parsed = parse(TEST_CONNECTION_STRING);
export let databaseDetails: Awaited<
ReturnType<typeof createTestDatabase>
> | null = null;

export const PGHOST = parsed.host || process.env.PGHOST;
export const PGDATABASE = parsed.database || undefined;
beforeAll(async () => {
databaseDetails = await createTestDatabase();
});
afterAll(async () => {
databaseDetails?.release();
});

export const GRAPHILE_WORKER_SCHEMA =
process.env.GRAPHILE_WORKER_SCHEMA || "graphile_worker";
Expand All @@ -58,6 +98,7 @@ export const ESCAPED_GRAPHILE_WORKER_SCHEMA =
export async function withPgPool<T>(
cb: (pool: pg.Pool) => Promise<T>,
): Promise<T> {
const { TEST_CONNECTION_STRING } = databaseDetails!;
const pool = new pg.Pool({
connectionString: TEST_CONNECTION_STRING,
});
Expand All @@ -75,12 +116,17 @@ afterEach(() => {
});

export async function withPgClient<T>(
cb: (client: pg.PoolClient) => Promise<T>,
cb: (
client: pg.PoolClient,
extra: {
TEST_CONNECTION_STRING: string;
},
) => Promise<T>,
): Promise<T> {
return withPgPool(async (pool) => {
const client = await pool.connect();
try {
return await cb(client);
return await cb(client, databaseDetails!);
} finally {
client.release();
}
Expand Down Expand Up @@ -125,7 +171,18 @@ export async function reset(
}
}

export async function jobCount(
/**
* Counts the number of jobs currently in DB.
*
* If you have a pool, you may hit race conditions with this method, instead
* use `expectJobCount()` which will try multiple times to give time for
* multiple clients to synchronize.
*/
export async function jobCount(pgClient: pg.PoolClient): Promise<number> {
return _jobCount(pgClient);
}

async function _jobCount(
pgPoolOrClient: pg.Pool | pg.PoolClient,
): Promise<number> {
const {
Expand Down Expand Up @@ -296,3 +353,28 @@ export function withOptions<T>(
}),
);
}

/**
* Wait for the job count to match the expected count, handles
* issues with different connections to the database not
* reflecting the same data by retrying.
*/
export async function expectJobCount(
// NOTE: if you have a pgClient then you shouldn't need to
// use this - just call `jobCount()` directly since you're
// in the same client
pool: pg.Pool,
expectedCount: number,
) {
let count: number = Infinity;
for (let i = 0; i < 8; i++) {
if (i > 0) {
await sleep(i * 50);
}
count = await _jobCount(pool);
if (count === expectedCount) {
break;
}
}
expect(count).toEqual(expectedCount);
}
3 changes: 1 addition & 2 deletions __tests__/jobsView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import {
ESCAPED_GRAPHILE_WORKER_SCHEMA,
makeSelectionOfJobs,
reset,
TEST_CONNECTION_STRING,
withPgClient,
} from "./helpers";

const options: WorkerSharedOptions = {};

test("jobs view renders jobs", () =>
withPgClient(async (pgClient) => {
withPgClient(async (pgClient, { TEST_CONNECTION_STRING }) => {
await reset(pgClient, options);

const utils = await makeWorkerUtils({
Expand Down
4 changes: 2 additions & 2 deletions __tests__/main.runTaskList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Task, TaskList, WorkerSharedOptions } from "../src/interfaces";
import { runTaskList } from "../src/main";
import {
ESCAPED_GRAPHILE_WORKER_SCHEMA,
jobCount,
expectJobCount,
reset,
sleep,
sleepUntil,
Expand Down Expand Up @@ -70,7 +70,7 @@ test("main will execute jobs as they come up, and exits cleanly", () =>
await sleep(1);
expect(finished).toBeTruthy();
await workerPool.promise;
expect(await jobCount(pgPool)).toEqual(0);
await expectJobCount(pgPool, 0);
expect(process.listeners("SIGTERM")).toHaveLength(0);
} finally {
Object.values(jobPromises).forEach((p) => p?.resolve());
Expand Down
4 changes: 2 additions & 2 deletions __tests__/runner.helpers.getTaskName.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Pool, PoolClient } from "pg";
import { DbJobSpec, Runner, RunnerOptions } from "../src/interfaces";
import { run } from "../src/runner";
import {
databaseDetails,
ESCAPED_GRAPHILE_WORKER_SCHEMA,
sleepUntil,
TEST_CONNECTION_STRING,
withPgClient,
} from "./helpers";

Expand All @@ -15,7 +15,7 @@ let runner: Runner | null = null;
const JOB_COUNT = 10;
beforeAll(() => {
pgPool = new Pool({
connectionString: TEST_CONNECTION_STRING,
connectionString: databaseDetails!.TEST_CONNECTION_STRING,
max: JOB_COUNT * 2 + 5,
});
});
Expand Down
53 changes: 28 additions & 25 deletions __tests__/runner.runOnce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import { makeWorkerPresetWorkerOptions } from "../src/config";
import { RunnerOptions } from "../src/interfaces";
import { WorkerPreset } from "../src/preset";
import { runOnce } from "../src/runner";
import {
PGDATABASE,
PGHOST,
TEST_CONNECTION_STRING,
withPgPool,
} from "./helpers";
import { databaseDetails, withPgPool } from "./helpers";

delete process.env.DATABASE_URL;
delete process.env.PGDATABASE;
Expand Down Expand Up @@ -57,7 +52,7 @@ async function runOnceErrorAssertion(

test("either a list of tasks or a existent task directory must be provided", async () => {
const options: RunnerOptions = {
connectionString: TEST_CONNECTION_STRING,
connectionString: databaseDetails!.TEST_CONNECTION_STRING,
};
await runOnceErrorAssertion(
options,
Expand All @@ -67,7 +62,7 @@ test("either a list of tasks or a existent task directory must be provided", asy

test("taskList and taskDirectory cannot be provided a the same time", async () => {
const options: RunnerOptions = {
connectionString: TEST_CONNECTION_STRING,
connectionString: databaseDetails!.TEST_CONNECTION_STRING,
taskDirectory: "foo",
taskList: { task: () => {} },
};
Expand All @@ -90,7 +85,7 @@ test("at least a connectionString, a pgPool, the DATABASE_URL or PGDATABASE envv
test("connectionString and a pgPool cannot provided a the same time", async () => {
const options: RunnerOptions = {
taskList: { task: () => {} },
connectionString: TEST_CONNECTION_STRING,
connectionString: databaseDetails!.TEST_CONNECTION_STRING,
pgPool: new Pool(),
};
await runOnceErrorAssertion(
Expand All @@ -100,34 +95,42 @@ test("connectionString and a pgPool cannot provided a the same time", async () =
});

test("providing just a DATABASE_URL is possible", async () => {
return withEnv({ DATABASE_URL: TEST_CONNECTION_STRING }, async () => {
const options: RunnerOptions = {
taskList: { task: () => {} },
};
expect.assertions(0);
await runOnce(options);
});
return withEnv(
{ DATABASE_URL: databaseDetails!.TEST_CONNECTION_STRING },
async () => {
const options: RunnerOptions = {
taskList: { task: () => {} },
};
expect.assertions(0);
await runOnce(options);
},
);
});

test("providing just PGHOST and PGDATABASE is possible", async () => {
return withEnv({ PGHOST, PGDATABASE }, async () => {
const options: RunnerOptions = {
taskList: { task: () => {} },
};
expect.assertions(0);
await runOnce(options);
});
return withEnv(
{
PGHOST: databaseDetails!.PGHOST,
PGDATABASE: databaseDetails!.PGDATABASE,
},
async () => {
const options: RunnerOptions = {
taskList: { task: () => {} },
};
expect.assertions(0);
await runOnce(options);
},
);
});

test("providing just a connectionString is possible", async () => {
const options: RunnerOptions = {
taskList: { task: () => {} },
connectionString: TEST_CONNECTION_STRING,
connectionString: databaseDetails!.TEST_CONNECTION_STRING,
};
expect.assertions(0);
await runOnce(options);
});

test("providing just a pgPool is possible", async () =>
withPgPool(async (pgPool) => {
const options: RunnerOptions = {
Expand Down
Loading
Loading