Skip to content

Commit

Permalink
Adjust testing runtime use
Browse files Browse the repository at this point in the history
  • Loading branch information
chuck-dbos committed Oct 23, 2024
1 parent 7949298 commit db2d0f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
9 changes: 2 additions & 7 deletions packages/dbos-dbtriggers/tests/dbtriggers_seq.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ const testTableName = "dbos_test_trig_seq";

type KnexTransactionContext = TransactionContext<Knex>;

interface TestingRuntimeImpl {
destroyEventReceivers() : Promise<void>;
initEventReceivers(): Promise<void>;
}

class DBOSTestNoClass {

}
Expand Down Expand Up @@ -140,7 +135,7 @@ describe("test-db-triggers", () => {
expect(DBOSTriggerTestClassSN.tsRecordMap.get(2)?.status).toBe("Ordered");

// Take down
await (testRuntime as unknown as TestingRuntimeImpl).destroyEventReceivers();
//await testRuntime.deactivateEventReceivers();

// Do more stuff
// Invalid record, won't show up because it is well out of sequence
Expand All @@ -155,7 +150,7 @@ describe("test-db-triggers", () => {
console.log("************************************************** Restart *****************************************************");
DBOSTriggerTestClassSN.reset();

await (testRuntime as unknown as TestingRuntimeImpl).initEventReceivers();
//await testRuntime.initEventReceivers();

console.log("************************************************** Restarted *****************************************************");
DBOSTriggerTestClassSN.reset();
Expand Down
7 changes: 4 additions & 3 deletions src/testing/testing_runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface TestingRuntime {

destroy(): Promise<void>; // Release resources after tests.
deactivateEventReceivers(): Promise<void>; // Deactivate event receivers.
initEventReceivers(): Promise<void>; // Init / reactivate event receivers.
}

/**
Expand Down Expand Up @@ -113,9 +114,6 @@ export class TestingRuntimeImpl implements TestingRuntime {
await this.#dbosExec.init(userClasses);
this.#server = new DBOSHttpServer(this.#dbosExec);
await this.initEventReceivers();
this.#scheduler = new DBOSScheduler(this.#dbosExec);
this.#scheduler.initScheduler();
this.#wfQueueRunner = wfQueueRunner.dispatchLoop(this.#dbosExec);
this.#applicationConfig = this.#dbosExec.config.application ?? {};
this.#isInitialized = true;
}
Expand All @@ -124,6 +122,9 @@ export class TestingRuntimeImpl implements TestingRuntime {
for (const evtRcvr of this.#dbosExec!.eventReceivers) {
await evtRcvr.initialize(this.#dbosExec!);
}
this.#scheduler = new DBOSScheduler(this.#dbosExec!);
this.#scheduler.initScheduler();
this.#wfQueueRunner = wfQueueRunner.dispatchLoop(this.#dbosExec!);
}

/**
Expand Down

0 comments on commit db2d0f0

Please sign in to comment.