Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

test(e2e): correct why the boot env forces queue and Redis off

Yudhi Armyndharis034bd519ec45
diff --git a/test/setup-e2e-env.e2e-spec.ts b/test/setup-e2e-env.e2e-spec.ts
index cc34112ec..247e62476 100644
--- a/test/setup-e2e-env.e2e-spec.ts
+++ b/test/setup-e2e-env.e2e-spec.ts
@@ -1,10 +1,10 @@
/**
- * Boot-env contract for the e2e family: setup-e2e.ts (a jest setupFile) re-runs before every
- * suite in the worker, so each suite must boot with queue and Redis off regardless of what an
- * earlier suite in the same worker left in process.env — queue-on.e2e-spec.ts mutates
- * REDIS_ENABLED at module load and can't restore it when it self-skips. Run alone this passes
- * trivially; its regression value is in a shared-worker run after queue-on (or with a dirty
- * ambient env), where a missing reset shows up as REDIS_ENABLED !== 'false' here.
+ * Boot-env contract for the e2e family: setup-e2e.ts (a jest setupFile) runs before every suite,
+ * so each suite must boot with queue and Redis off regardless of an ambient REDIS_ENABLED or
+ * QUEUE_ENABLED inherited from the developer's shell or the CI env. Writes from an earlier suite
+ * cannot carry over: jest gives each test file its own copy of process.env. Run in a clean env
+ * this passes trivially; its regression value is in a dirty ambient env, where a missing reset
+ * shows up as REDIS_ENABLED !== 'false' here.
*/
import { Controller, Get, INestApplication, Module } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
diff --git a/test/setup-e2e.ts b/test/setup-e2e.ts
index ce40f993b..97fe68302 100644
--- a/test/setup-e2e.ts
+++ b/test/setup-e2e.ts
@@ -132,9 +132,8 @@ const e2eKeyFile = join(tmpdir(), `openwa-e2e-key-${process.pid}`);
rmSync(e2eKeyFile, { force: true });
process.env.BOOTSTRAP_KEY_FILE = e2eKeyFile;
process.env.QUEUE_ENABLED = 'false';
-// Likewise force Redis off per suite: queue-on.e2e-spec.ts flips REDIS_ENABLED=true at module
-// load and can't restore it when it self-skips, so without this reset later suites in the same
-// jest worker would boot with Redis-backed throttling/cache.
+// Likewise force Redis off per suite, over an ambient REDIS_ENABLED inherited from the developer's
+// shell or the CI env; without this reset a suite would boot with Redis-backed throttling/cache.
process.env.REDIS_ENABLED = 'false';
process.env.AUTO_START_SESSIONS = 'false';
// Keep the auth/audit + data schema zero-config for the test boot.