Skip to content

Commit

Permalink
Ensure consistent state during execute
Browse files Browse the repository at this point in the history
  • Loading branch information
darunrs committed Apr 18, 2024
1 parent d657e9d commit 556d48d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions runner/src/indexer/indexer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ describe('Indexer unit tests', () => {
getPgBouncerConnectionParameters: jest.fn().mockReturnValue(genericDbCredentials),
fetchUserApiProvisioningStatus: jest.fn().mockResolvedValue(true),
provisionLogsAndMetadataIfNeeded: jest.fn(),
ensureConsistentHasuraState: jest.fn(),
} as unknown as Provisioner;

const config = {
Expand Down Expand Up @@ -930,6 +931,7 @@ describe('Indexer unit tests', () => {
fetchUserApiProvisioningStatus: jest.fn().mockReturnValue(false),
provisionUserApi: jest.fn(),
provisionLogsAndMetadataIfNeeded: jest.fn(),
ensureConsistentHasuraState: jest.fn(),
};
const indexerMeta = {
writeLogs: jest.fn(),
Expand Down Expand Up @@ -975,6 +977,7 @@ describe('Indexer unit tests', () => {
fetchUserApiProvisioningStatus: jest.fn().mockReturnValue(true),
provisionUserApi: jest.fn(),
provisionLogsAndMetadataIfNeeded: jest.fn(),
ensureConsistentHasuraState: jest.fn(),
};
const indexer = new Indexer(simpleSchemaConfig, {
fetch: mockFetch as unknown as typeof fetch,
Expand Down Expand Up @@ -1012,6 +1015,7 @@ describe('Indexer unit tests', () => {
fetchUserApiProvisioningStatus: jest.fn().mockReturnValue(true),
provisionUserApi: jest.fn(),
provisionLogsAndMetadataIfNeeded: jest.fn(),
ensureConsistentHasuraState: jest.fn(),
};
const indexerMeta = {
writeLogs: jest.fn(),
Expand Down Expand Up @@ -1060,6 +1064,7 @@ describe('Indexer unit tests', () => {
fetchUserApiProvisioningStatus: jest.fn().mockReturnValue(true),
provisionUserApi: jest.fn(),
provisionLogsAndMetadataIfNeeded: jest.fn(),
ensureConsistentHasuraState: jest.fn(),
};
const indexerMeta = {
writeLogs: jest.fn(),
Expand Down Expand Up @@ -1111,6 +1116,7 @@ describe('Indexer unit tests', () => {
provisionUserApi: jest.fn().mockRejectedValue(error),
provisionLogsIfNeeded: jest.fn(),
provisionMetadataIfNeeded: jest.fn(),
ensureConsistentHasuraState: jest.fn(),
};
const indexerMeta = {
writeLogs: jest.fn(),
Expand Down
1 change: 1 addition & 0 deletions runner/src/indexer/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default class Indexer {
logEntries.push(provisionSuccessLogEntry);
}
await this.deps.provisioner.provisionLogsAndMetadataIfNeeded(this.indexerConfig);
await this.deps.provisioner.ensureConsistentHasuraState(this.indexerConfig);
} catch (e) {
const error = e as Error;
simultaneousPromises.push(this.writeLogOld(LogLevel.ERROR, blockHeight, `Provisioning endpoint: failure:${error.message}`));
Expand Down

0 comments on commit 556d48d

Please sign in to comment.