diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index c47ecf97c..cfb8a3a5d 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -40,6 +40,7 @@ services: environment: DOCDB_USER: hyperdx DOCDB_PASSWORD: hyperdx + DOCDB_DISABLE_TTL: 'true' ports: - '127.0.0.1:${HDX_CI_MONGO_PORT:-39999}:10260' networks: diff --git a/docker/documentdb/entrypoint.sh b/docker/documentdb/entrypoint.sh index d7b294b23..35c46c807 100755 --- a/docker/documentdb/entrypoint.sh +++ b/docker/documentdb/entrypoint.sh @@ -42,6 +42,13 @@ else start_postgres fi +# Integration tests write documents with timestamps far in the past, so the +# once-a-minute TTL purge can delete them mid-test. +if [ "${DOCDB_DISABLE_TTL:-false}" = true ]; then + psql -h /tmp -U postgres -d postgres -qtAX -v ON_ERROR_STOP=1 \ + -c "SELECT cron.unschedule(jobid) FROM cron.job WHERE jobname = 'documentdb_ttl_task';" >/dev/null +fi + echo "postgresql://postgres@localhost:5432/postgres" > /tmp/pg-url mkdir -p /tmp/tls export DOCUMENTDB_PG_URL_FILE=/tmp/pg-url DOCUMENTDB_TLS_STATE_DIR=/tmp/tls diff --git a/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts b/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts index 2fe606d23..7bb6cb4c2 100644 --- a/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts +++ b/packages/api/src/tasks/checkAlerts/__tests__/checkAlerts.int.test.ts @@ -2022,8 +2022,11 @@ describe('checkAlerts', () => { getMetadata: jest.fn().mockReturnValue(mockMetadata), })); + // clearAllMocks keeps implementations, so reset to stop one test's + // mockRejectedValue leaking into the next. jest .spyOn(slack, 'postMessageToWebhook') + .mockReset() .mockResolvedValueOnce(fromAny(null)); jest.spyOn(checkAlert, 'handleSendGenericWebhook');