chore: drop comments that restate the code

This commit is contained in:
edmand46
2026-09-29 16:43:15 +03:00
parent 17a55888a5
commit 4a167df587
25 changed files with 16 additions and 350 deletions
+2 -6
View File
@@ -1,7 +1,3 @@
// Minimal fetch wrapper for the LiveOps platform/admin HTTP API used by the seed
// and by tests' admin-side assertions. Retries network errors and 5xx with backoff;
// fails fast on 4xx.
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
export class ApiError extends Error {
@@ -54,8 +50,8 @@ export function createAdminClient(baseUrl: string): AdminClient {
if (!res.ok) throw new ApiError(res.status, path, text);
return (text ? JSON.parse(text) : undefined) as T;
} catch (err) {
if (err instanceof ApiError) throw err; // 4xx — don't retry
lastErr = err; // network error — retry
if (err instanceof ApiError) throw err;
lastErr = err;
await sleep(300 * (attempt + 1));
}
}
-9
View File
@@ -1,9 +1,3 @@
// Vitest globalSetup for the production e2e suite.
//
// Setup: seeds a fresh project on prod (unless RUDDER_E2E_PROJECT_KEY is provided) and
// writes .e2e-prod.local.json for the tests to read.
// Teardown: deletes the seeded project (default). Set RUDDER_E2E_KEEP=1 to keep it.
import { runSeed, deleteProject } from './seed.js';
import { readArtifact, writeArtifact, removeArtifact } from './artifact.js';
import type { SeedArtifact } from './types.js';
@@ -11,15 +5,12 @@ import type { SeedArtifact } from './types.js';
export default async function setup(): Promise<() => Promise<void>> {
const baseUrl = process.env.RUDDER_E2E_BASE_URL ?? 'https://api.rudder.build';
// Externally-provided project: skip seeding, just verify an artifact/env exists.
if (process.env.RUDDER_E2E_PROJECT_KEY) {
const existing = readArtifact();
if (!existing) {
writeArtifact({
baseUrl,
projectKey: process.env.RUDDER_E2E_PROJECT_KEY,
// Remaining fields are unknown for an external project; tests relying on the
// seeded dataset/admin token will require a real seed run.
} as unknown as SeedArtifact);
}
return async () => {};
-5
View File
@@ -1,11 +1,8 @@
// Test-side helpers: load the seed artifact and build SDK clients against prod.
import { RudderClient, createClient } from '../../../src/client/RudderClient.js';
import type { TokenStore } from '../../../src/token/TokenStore.js';
import { readArtifact } from './artifact.js';
import type { SeedArtifact } from './types.js';
/** Loads the seed artifact; RUDDER_E2E_* env vars override file values. */
export function loadArtifact(): SeedArtifact {
const file = readArtifact();
if (!file) {
@@ -37,7 +34,6 @@ export function createInMemoryTokenStore(): TokenStore {
};
}
/** A client with no auth yet (in-memory tokens). */
export function makeProdClient(
artifact: SeedArtifact = loadArtifact(),
): RudderClient {
@@ -48,7 +44,6 @@ export function makeProdClient(
});
}
/** A device-authenticated client. In Node each call mints a fresh player (ephemeral device id). */
export async function freshPlayer(
artifact: SeedArtifact = loadArtifact(),
): Promise<RudderClient> {
-4
View File
@@ -1,7 +1,3 @@
// Production seed: registers an operator and creates a project. Creating a
// project provisions staging + prod environments; the prod SDK key is what
// the runtime SDK sends as projectKey.
import { createAdminClient } from './adminClient.js';
import type { SeedArtifact } from './types.js';
-4
View File
@@ -1,11 +1,7 @@
// Shared types for the production e2e harness.
/** Persisted seed output, written to .e2e-prod.local.json and read by tests. */
export interface SeedArtifact {
baseUrl: string;
projectId: string;
projectKey: string;
/** Operator (platform) bearer token — used for admin calls (wallet grant, player details). */
adminToken: string;
adminEmail: string;
environment: string;
-1
View File
@@ -1,7 +1,6 @@
import { describe, it, expect, beforeAll } from 'vitest';
import { loadArtifact } from './_setup/harness.js';
// Smoke gate: if egress to prod is blocked or the gateway is down, fail fast here.
describe('e2e-prod: health', () => {
let baseUrl: string;
beforeAll(() => {