Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

1.4 KB
Raw Blame
import { describeTenantIsolationConformance } from '~/tenant/conformance';
import { createMongooseTenantHarness } from '~/tenant/harness';

/**
 * The portable tenant-isolation contract against a live engine: FerretDB (PostgreSQL +
 * DocumentDB extension), or any MongoDB-compatible server for parity. It covers the
 * single-partition reads that config resolution relies on, whose tenantless filter
 * (`$exists: false`, `null` and `''`) must mean the same on every engine.
 *
 * Run against FerretDB (see docker-compose.ferretdb.yml):
 *   FERRETDB_URI="mongodb://ferretdb:[email protected]:27020/tenant_conformance" \
 *     npx jest --config misc/ferretdb/jest.ferretdb.config.mjs tenantIsolation.ferretdb
 *
 * Run against MongoDB (for parity):
 *   FERRETDB_URI="mongodb://127.0.0.1:27017/tenant_conformance" \
 *     npx jest --config misc/ferretdb/jest.ferretdb.config.mjs tenantIsolation.ferretdb
 */

const FERRETDB_URI = process.env.FERRETDB_URI;

if (FERRETDB_URI) {
  describeTenantIsolationConformance(
    createMongooseTenantHarness({
      name: `mongoose on ${new URL(FERRETDB_URI).host}`,
      connect: async () => FERRETDB_URI,
      release: async () => undefined,
    }),
  );
} else {
  describe.skip('tenant isolation conformance (set FERRETDB_URI to run)', () => {
    it('runs against a live engine', () => {
      expect(FERRETDB_URI).toBeDefined();
    });
  });
}