mirror of
https://github.com/PostHog/posthog.git
synced 2024-12-01 12:21:02 +01:00
64317238e6
* refactor: Eliminate the `KAFKA_ENABLED` setting * Remove dead code * Consolidate plugin server test scripts and CI * Fix CI command * Remove Celery queues * Rearrange test directories * Update import paths
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import Piscina from '@posthog/piscina'
|
|
|
|
import { KafkaQueue } from '../../src/main/ingestion-queues/kafka-queue'
|
|
import { startQueues } from '../../src/main/ingestion-queues/queue'
|
|
import { Hub, LogLevel } from '../../src/types'
|
|
import { createHub } from '../../src/utils/db/hub'
|
|
|
|
jest.mock('../../src/main/ingestion-queues/kafka-queue')
|
|
|
|
describe('queue', () => {
|
|
describe('capabilities', () => {
|
|
let hub: Hub
|
|
let piscina: Piscina
|
|
let closeHub: () => Promise<void>
|
|
|
|
beforeEach(async () => {
|
|
;[hub, closeHub] = await createHub({
|
|
LOG_LEVEL: LogLevel.Warn,
|
|
})
|
|
piscina = { run: jest.fn() } as any
|
|
})
|
|
|
|
afterEach(async () => {
|
|
await closeHub()
|
|
})
|
|
|
|
it('starts ingestion queue by default', async () => {
|
|
const queues = await startQueues(hub, piscina)
|
|
|
|
expect(queues).toEqual({
|
|
ingestion: expect.any(KafkaQueue),
|
|
})
|
|
})
|
|
|
|
it('handles ingestion being turned off', async () => {
|
|
hub.capabilities.ingestion = false
|
|
hub.capabilities.processAsyncHandlers = false
|
|
|
|
const queues = await startQueues(hub, piscina)
|
|
|
|
expect(queues).toEqual({
|
|
ingestion: null,
|
|
})
|
|
})
|
|
})
|
|
})
|