From 8c0d01e88dc9ab349e6934eadfa529f9ad8a3048 Mon Sep 17 00:00:00 2001 From: Karl-Aksel Puulmann Date: Fri, 13 May 2022 12:22:37 +0300 Subject: [PATCH] fix(plugin-server): remove dead code from worker.test.ts Follow-up to https://github.com/PostHog/posthog/pull/9738, silly mistake --- plugin-server/tests/postgres/worker.test.ts | 46 +-------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/plugin-server/tests/postgres/worker.test.ts b/plugin-server/tests/postgres/worker.test.ts index e5fcde383b277..ed7561addf2f1 100644 --- a/plugin-server/tests/postgres/worker.test.ts +++ b/plugin-server/tests/postgres/worker.test.ts @@ -1,18 +1,14 @@ import { PluginEvent } from '@posthog/plugin-scaffold/src/types' -import IORedis from 'ioredis' import { mocked } from 'ts-jest/utils' -import { ServerInstance, startPluginsServer } from '../../src/main/pluginsServer' import { loadPluginSchedule } from '../../src/main/services/schedule' -import { Hub, LogLevel } from '../../src/types' -import { Client } from '../../src/utils/celery/client' +import { Hub } from '../../src/types' import { createHub } from '../../src/utils/db/hub' import { KafkaProducerWrapper } from '../../src/utils/db/kafka-producer-wrapper' import { delay, UUIDT } from '../../src/utils/utils' import { ActionManager } from '../../src/worker/ingestion/action-manager' import { ActionMatcher } from '../../src/worker/ingestion/action-matcher' import { ingestEvent } from '../../src/worker/ingestion/ingest-event' -import { makePiscina } from '../../src/worker/piscina' import { runPluginTask, runProcessEvent } from '../../src/worker/plugins/run' import { loadSchedule, setupPlugins } from '../../src/worker/plugins/setup' import { teardownPlugins } from '../../src/worker/plugins/teardown' @@ -124,46 +120,6 @@ describe('worker', () => { } catch {} }) - describe('queue logic', () => { - let pluginsServer: ServerInstance - let redis: IORedis.Redis - - beforeEach(async () => { - const testCode = ` - async function processEvent (event) { - await new Promise(resolve => __jestSetTimeout(resolve, 1000)) - return event - } - ` - await resetTestDatabase(testCode) - pluginsServer = await startPluginsServer( - { - WORKER_CONCURRENCY: 2, - TASKS_PER_WORKER: 2, - REDIS_POOL_MIN_SIZE: 3, - REDIS_POOL_MAX_SIZE: 3, - PLUGINS_CELERY_QUEUE: `test-plugins-celery-queue-${new UUIDT()}`, - CELERY_DEFAULT_QUEUE: `test-celery-default-queue-${new UUIDT()}`, - LOG_LEVEL: LogLevel.Debug, - }, - makePiscina - ) - - redis = await pluginsServer.hub.redisPool.acquire() - - await redis.del(pluginsServer.hub.PLUGINS_CELERY_QUEUE) - await redis.del(pluginsServer.hub.CELERY_DEFAULT_QUEUE) - }) - - afterEach(async () => { - // :TRICKY: Ignore errors when stopping workers. - try { - await pluginsServer.hub.redisPool.release(redis) - await pluginsServer.stop() - } catch {} - }) - }) - describe('createTaskRunner()', () => { let taskRunner: any let hub: Hub