Skip to content

Commit

Permalink
Just reset everything each test run rather than trying to figure out …
Browse files Browse the repository at this point in the history
…what is happening here.
  • Loading branch information
tkaemming committed Nov 21, 2023
1 parent 185d834 commit 3061bd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 2 additions & 0 deletions plugin-server/src/worker/ingestion/app-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ export class AppMetrics {
} as RawAppMetric),
}))

console.dir(this.kafkaProducer)

await this.kafkaProducer.queueMessage({
topic: KAFKA_APP_METRICS,
messages: kafkaMessages,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,21 @@ describe('runAppsOnEventPipeline()', () => {
let redis: Redis.Redis
let closeHub: () => Promise<void>

beforeEach(() => {
beforeEach(async () => {
// Use fake timers to ensure that we don't need to wait on e.g. retry logic.
jest.useFakeTimers({ advanceTimers: true })
})

beforeAll(async () => {
jest.useFakeTimers({ advanceTimers: true })
;[hub, closeHub] = await createHub()
redis = await hub.redisPool.acquire()
await hub.postgres.query(PostgresUse.COMMON_WRITE, POSTGRES_DELETE_TABLES_QUERY, null, 'deleteTables') // Need to clear the DB to avoid unique constraint violations on ids
})

afterEach(() => {
jest.clearAllTimers()
jest.useRealTimers()
jest.restoreAllMocks()
})

afterAll(async () => {
afterEach(async () => {
await hub.redisPool.release(redis)
await teardownPlugins(hub)
await closeHub()
jest.clearAllTimers()
jest.useRealTimers()
jest.restoreAllMocks()
})

test('throws on produce errors', async () => {
Expand Down

0 comments on commit 3061bd0

Please sign in to comment.