Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(ui): rp-014 rp-015 run the drag journeys on hosted GKE dev and prove the cleanup
Mca7f2a060f73
diff --git a/control-ui/e2e/gfs-drag-and-drop.spec.ts b/control-ui/e2e/gfs-drag-and-drop.spec.tsindex ffe20e409..054d3cb15 100644--- a/control-ui/e2e/gfs-drag-and-drop.spec.ts+++ b/control-ui/e2e/gfs-drag-and-drop.spec.ts@@ -14,12 +14,11 @@// cannot synthesize the custom `application/x-evenfire-gfs-resource` payload// the browser sets on the draggable rows, while mouse.down/move/up over a// draggable=true element makes Chromium run the real HTML5 DnD sequence.-import { type APIRequestContext, type Locator, type Page, expect, test } from '@playwright/test'+import { type Locator, type Page, expect, test } from '@playwright/test'import {CONTROL_API_URL,CONTROL_UI_URL,adminCredentials,- api,assertAllowedTarget,createSecureTempFile,loginThroughUi,@@ -70,43 +69,129 @@ function toast(page: Page, text: string): Locator {}/**- * Best-effort recursive cleanup: walk the drive from its root and delete- * every fixture resource with a matching exact name, children before- * parents. Journeys only move fixtures between self-created folders, so a- * moved fixture always remains inside the fixture subtree the sweep covers.+ * Call the Control API operator plane FROM THE PAGE, so the admin session+ * cookie is always attached.+ *+ * `page.request` is not used here on purpose: Playwright's request context+ * only exempts `localhost` from the secure-cookie-over-http filter, so a+ * `http://127.0.0.1:<port>` CONTROL_UI_URL makes every `page.request` call+ * unauthenticated (401) while the browser session itself is live. A cleanup+ * that silently 401s leaves the shared drive dirty and still reports the+ * journey as green. Fetching from inside the page uses the browser's own+ * cookie jar, so the cleanup behaves the same for every host spelling.*/-async function cleanupGfsDragDropFixtures(- request: APIRequestContext,- names: ReadonlySet<string>-): Promise<void> {- try {- const tree = await api<{ items?: GfsChild[]; rootResourceId?: string }>(- request,+async function adminFetch(+ page: Page,+ method: string,+ pathName: string,+ body?: unknown+): Promise<{ status: number; data: Record<string, unknown> }> {+ return page.evaluate(+ async ([requestMethod, requestPath, requestBody]) => {+ const response = await fetch(requestPath, {+ method: requestMethod,+ headers: requestBody ? { 'content-type': 'application/json' } : {},+ body: requestBody ? JSON.stringify(requestBody) : undefined,+ credentials: 'same-origin',+ })+ const text = await response.text()+ let data: Record<string, unknown> = {}+ try {+ data = text ? (JSON.parse(text) as Record<string, unknown>) : {}+ } catch {+ data = { raw: text }+ }+ return { status: response.status, data }+ },+ [method, pathName, body ?? null] as const+ )+}++/** Every child of a folder, following the listing cursor to the end. */+async function listChildren(page: Page, parentResourceId: string): Promise<GfsChild[]> {+ const items: GfsChild[] = []+ let cursor: string | null = null+ do {+ const query = cursor ? `&cursor=${encodeURIComponent(cursor)}` : ''+ const response = await adminFetch(+ page,'GET',- '/api/v1/gfs/tree?drive=main'+ `/control-api/api/v1/gfs/resources/${encodeURIComponent(parentResourceId)}/children?drive=main${query}`)- const rootResourceId = tree.data.rootResourceId- if (!rootResourceId) return+ if (response.status !== 200) {+ throw new Error(`children listing failed with HTTP ${response.status}`)+ }+ const payload = response.data as { items?: GfsChild[]; nextCursor?: string | null }+ items.push(...(payload.items ?? []))+ cursor = payload.nextCursor ?? null+ } while (cursor)+ return items+}++/**+ * Recursive cleanup: walk the drive from its root and delete every fixture+ * resource with a matching exact name, children before parents. Journeys only+ * move fixtures between self-created folders, so a moved fixture always+ * remains inside the fixture subtree the sweep covers.+ *+ * The cleanup PROVES itself: every fixture name must be gone when the sweep+ * finishes. A leftover fixture fails the journey loudly instead of silently+ * dirtying the shared drive.+ */+async function cleanupGfsDragDropFixtures(page: Page, names: ReadonlySet<string>): Promise<void> {+ const failures: string[] = []+ try {+ const tree = await adminFetch(page, 'GET', '/control-api/api/v1/gfs/tree?drive=main')+ if (tree.status !== 200) {+ throw new Error(`drive tree failed with HTTP ${tree.status}`)+ }+ const rootResourceId = (tree.data as { rootResourceId?: string }).rootResourceId+ if (!rootResourceId) throw new Error('the drive root id did not resolve')async function sweep(parentResourceId: string): Promise<void> {- const children = await api<{ items?: GfsChild[] }>(- request,- 'GET',- `/api/v1/gfs/resources/${encodeURIComponent(parentResourceId)}/children?drive=main`- )- for (const child of children.data.items ?? []) {+ for (const child of await listChildren(page, parentResourceId)) {if (!names.has(child.name)) continueif (child.kind === 'directory') await sweep(child.resourceId)- await api(- request,+ const deleted = await adminFetch(+ page,'DELETE',- `/api/v1/gfs/proxy/v1/resources/${encodeURIComponent(child.rid)}`,+ `/control-api/api/v1/gfs/proxy/v1/resources/${encodeURIComponent(child.rid)}`,{ ifMatch: child.version })+ if (deleted.status >= 300) {+ failures.push(`delete ${child.name} failed with HTTP ${deleted.status}`)+ }}}await sweep(rootResourceId)- } catch {- // Best-effort: EvenDrive is global, so leftover fixtures are the only concern.+ } catch (caught) {+ failures.push(`sweep failed: ${caught instanceof Error ? caught.message : String(caught)}`)+ }++ // Prove the cleanup: no fixture name may survive anywhere under the root.+ const survivors: string[] = []+ try {+ const tree = await adminFetch(page, 'GET', '/control-api/api/v1/gfs/tree?drive=main')+ const rootResourceId = (tree.data as { rootResourceId?: string }).rootResourceId+ if (!rootResourceId) throw new Error('the drive root id did not resolve for the check')+ const walk = async (parentResourceId: string, depth: number): Promise<void> => {+ if (depth > 6) return+ for (const child of await listChildren(page, parentResourceId)) {+ if (names.has(child.name)) survivors.push(child.name)+ if (child.kind === 'directory') await walk(child.resourceId, depth + 1)+ }+ }+ await walk(rootResourceId, 0)+ } catch (caught) {+ failures.push(+ `cleanup verification failed: ${caught instanceof Error ? caught.message : String(caught)}`+ )+ }++ if (survivors.length > 0) {+ failures.push(`fixtures still present after cleanup: ${survivors.join(', ')}`)+ }+ if (failures.length > 0) {+ throw new Error(`[gfs-dnd] fixture cleanup incomplete — ${failures.join(' | ')}`)}}@@ -225,7 +310,7 @@ test.describe('EvenDrive drag and drop', () => {await screenshotAndLog(page, testInfo, 'gfs-dnd-file-move')} finally {await tempFile?.cleanup().catch(() => {})- await cleanupGfsDragDropFixtures(page.request, new Set([parentName, folderName, fileName]))+ await cleanupGfsDragDropFixtures(page, new Set([parentName, folderName, fileName]))}})@@ -271,10 +356,7 @@ test.describe('EvenDrive drag and drop', () => {await expect(resourceRow(page, sourceName)).toBeVisible()await screenshotAndLog(page, testInfo, 'gfs-dnd-folder-cancel')} finally {- await cleanupGfsDragDropFixtures(- page.request,- new Set([parentName, sourceName, destinationName])- )+ await cleanupGfsDragDropFixtures(page, new Set([parentName, sourceName, destinationName]))}})@@ -312,10 +394,7 @@ test.describe('EvenDrive drag and drop', () => {await expect(resourceRow(page, sourceName)).toHaveCount(0)await screenshotAndLog(page, testInfo, 'gfs-dnd-folder-commit')} finally {- await cleanupGfsDragDropFixtures(- page.request,- new Set([parentName, sourceName, destinationName])- )+ await cleanupGfsDragDropFixtures(page, new Set([parentName, sourceName, destinationName]))}})@@ -387,7 +466,7 @@ test.describe('EvenDrive drag and drop', () => {await expect(dialog).toBeHidden({ timeout: 20_000 })} finally {await cleanupGfsDragDropFixtures(- page.request,+ page,new Set([outerName, folderAName, childOfAName, siblingName]))}@@ -442,7 +521,7 @@ test.describe('EvenDrive drag and drop', () => {await expect(resourceRow(page, fileName)).toBeVisible({ timeout: 20_000 })await screenshotAndLog(page, testInfo, 'gfs-dnd-os-drop-upload')} finally {- await cleanupGfsDragDropFixtures(page.request, new Set([parentName, fileName]))+ await cleanupGfsDragDropFixtures(page, new Set([parentName, fileName]))}})@@ -479,7 +558,7 @@ test.describe('EvenDrive drag and drop', () => {await expect(resourceRow(page, `${sourceName} (1)`)).toBeVisible({ timeout: 20_000 })} finally {await cleanupGfsDragDropFixtures(- page.request,+ page,new Set([parentName, sourceName, `${sourceName} (1)`, destinationName]))}@@ -523,10 +602,7 @@ test.describe('EvenDrive drag and drop', () => {// The source folder did not move.await expect(resourceRow(page, sourceName)).toBeVisible({ timeout: 20_000 })} finally {- await cleanupGfsDragDropFixtures(- page.request,- new Set([parentName, sourceName, destinationName])- )+ await cleanupGfsDragDropFixtures(page, new Set([parentName, sourceName, destinationName]))}})})diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 52422f78a..c129ea928 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.751",+ "version": "0.1.752","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.751",+ "version": "0.1.752","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/frontend-components": "file:../packages/frontend-components",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 6a4739a52..8aae36021 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.751",+ "version": "0.1.752","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/desktop-app/test/e2e-playwright/gfs-drag-and-drop-desktop.test.ts b/desktop-app/test/e2e-playwright/gfs-drag-and-drop-desktop.test.tsindex 23d0ccae7..d61172c4b 100644--- a/desktop-app/test/e2e-playwright/gfs-drag-and-drop-desktop.test.ts+++ b/desktop-app/test/e2e-playwright/gfs-drag-and-drop-desktop.test.ts@@ -28,7 +28,7 @@* row, so one fixture name yields a folder that holds both a file and a* child folder.*/-import { type Locator, type Page, expect, test } from '@playwright/test'+import { type ElectronApplication, type Locator, type Page, expect, test } from '@playwright/test'import {assertGfsFixtureCleaned,cleanupGfsFixture,@@ -50,21 +50,52 @@ function toast(page: Page, text: string): Locator {return page.locator('[role="status"], [role="alert"]').filter({ hasText: text })}+/**+ * A dropped `kubectl exec` stream is transport noise, not a verdict: the+ * shared harness opens one exec session per call and the stream can end+ * early. One bounded retry keeps the journey setup deterministic; a second+ * failure propagates.+ */+async function withTransportRetry<T>(what: string, action: () => T): Promise<T> {+ for (let attempt = 1; ; attempt += 1) {+ try {+ return action()+ } catch (caught) {+ const message = caught instanceof Error ? caught.message : String(caught)+ const transportNoise = /\bEOF\b|socket hang up|connection reset|stream closed/i.test(message)+ if (attempt >= 2 || !transportNoise) throw caught+ await new Promise(resolve => setTimeout(resolve, 1_500))+ }+ }+}+/*** Grant the fixture to the seeded E2E persona: read/write/delete, inherited* by the fixture subtree. Without this the fixtures exist but the persona* cannot read them, cannot move them, and the shared-with-me listing does* not carry them at all.*/-function grantFixtureToE2eUser(resourceId: string): void {- seedGfsGrant({- resourceId,- subjectType: 'user',- subjectId: getE2EUserId(),- permissions: ['read', 'write', 'delete'],- inherit: true,- grantedBy: 'e2e:gfs-drag-and-drop',- })+async function grantFixtureToE2eUser(resourceId: string): Promise<void> {+ await withTransportRetry('seedGfsGrant', () =>+ seedGfsGrant({+ resourceId,+ subjectType: 'user',+ subjectId: getE2EUserId(),+ permissions: ['read', 'write', 'delete'],+ inherit: true,+ grantedBy: 'e2e:gfs-drag-and-drop',+ })+ )+}++/** Seed a fixture folder (and its child) with one bounded transport retry. */+async function seedFixtureDirectory(name: string) {+ return withTransportRetry('seedGfsDirectoryFixture', () => seedGfsDirectoryFixture(name))+}++/** Seed a fixture file (and its folder) with one bounded transport retry. */+async function seedFixtureFile(name: string) {+ return withTransportRetry('seedGfsFileFixture', () => seedGfsFileFixture(name))}/**@@ -146,11 +177,16 @@ test.describe('EvenDrive drag and drop (desktop grid)', () => {// same fixture folder row, so the folder ends up holding BOTH the file// and the destination folder as siblings.const fixtureName = uniqueGfsFixtureName('e2e-gfs-dnd-file')- const file = seedGfsFileFixture(fixtureName)- const dir = seedGfsDirectoryFixture(fixtureName)- grantFixtureToE2eUser(dir.resourceId)- const { app, page } = await launchAndLogin()+ // The setup runs INSIDE the cleanup scope: a failed seed, grant or+ // login must not leave seeded rows behind.+ let app: ElectronApplication | undefinedtry {+ const file = await seedFixtureFile(fixtureName)+ const dir = await seedFixtureDirectory(fixtureName)+ await grantFixtureToE2eUser(dir.resourceId)+ const launched = await launchAndLogin()+ app = launched.app+ const page = launched.pageawait openFixtureFolder(page, fixtureName)const fileRow = gridRow(page, file.fileName)const dirRow = gridRow(page, dir.childName)@@ -180,7 +216,7 @@ test.describe('EvenDrive drag and drop (desktop grid)', () => {// The moved file is gone from the folder listing it was dragged out of.await expect(fileRow).toBeHidden({ timeout: 30_000 })} finally {- await app.close().catch(() => undefined)+ await app?.close().catch(() => undefined)cleanupGfsFixture(fixtureName)assertGfsFixtureCleaned(fixtureName)}@@ -189,16 +225,19 @@ test.describe('EvenDrive drag and drop (desktop grid)', () => {test('folder drag stops at the one confirmation: Cancel is a no-op, Move commits with impact info', async () => {const sourceName = uniqueGfsFixtureName('e2e-gfs-dnd-src')const destinationName = uniqueGfsFixtureName('e2e-gfs-dnd-dst')- const sourceDir = seedGfsDirectoryFixture(sourceName)- const destinationDir = seedGfsDirectoryFixture(destinationName)- // The moved folder is the fixture's CHILD, so its old parent is the- // fixture folder: the persona holds write+delete there and the move- // never needs authority on the drive root.- grantFixtureToE2eUser(sourceDir.resourceId)- grantFixtureToE2eUser(sourceDir.childResourceId)- grantFixtureToE2eUser(destinationDir.resourceId)- const { app, page } = await launchAndLogin()+ let app: ElectronApplication | undefinedtry {+ const sourceDir = await seedFixtureDirectory(sourceName)+ const destinationDir = await seedFixtureDirectory(destinationName)+ // The moved folder is the fixture's CHILD, so its old parent is the+ // fixture folder: the persona holds write+delete there and the move+ // never needs authority on the drive root.+ await grantFixtureToE2eUser(sourceDir.resourceId)+ await grantFixtureToE2eUser(sourceDir.childResourceId)+ await grantFixtureToE2eUser(destinationDir.resourceId)+ const launched = await launchAndLogin()+ app = launched.app+ const page = launched.pageawait openFilesSharedRoot(page)const sourceRow = gridRow(page, sourceDir.childName)const destinationRow = gridRow(page, destinationDir.name)@@ -261,7 +300,7 @@ test.describe('EvenDrive drag and drop (desktop grid)', () => {})).toBeNull()} finally {- await app.close().catch(() => undefined)+ await app?.close().catch(() => undefined)cleanupGfsFixture(sourceName)cleanupGfsFixture(destinationName)assertGfsFixtureCleaned(sourceName)diff --git a/desktop-app/test/e2e-playwright/global-setup.ts b/desktop-app/test/e2e-playwright/global-setup.tsindex 74ba4b267..ea08ca318 100644--- a/desktop-app/test/e2e-playwright/global-setup.ts+++ b/desktop-app/test/e2e-playwright/global-setup.ts@@ -167,6 +167,73 @@ function readGlobalKubectlCurrentContext(expectedContext: string): string {}).trim()}+/**+ * The services the Desktop lane drives on a hosted dev cluster. Each must+ * exist with a READY endpoint: a context that answers the API server but has+ * no ready backend is refused here instead of turning into a confusing 503+ * deep inside a journey.+ */+export const HOSTED_DEV_SERVICES: ReadonlyArray<readonly [string, string]> = [+ ['control-plane', 'control-api'],+ ['profiles', 'external-rest-api'],+ ['rpc-proxy', 'rpc-proxy'],+]++/** Reads the ready endpoint targets of one service ('' when none is ready). */+export type HostedDevEndpointReader = (+ context: string,+ namespace: string,+ service: string+) => string++function kubectlEndpointTargets(context: string, namespace: string, service: string): string {+ return execFileSync(+ 'kubectl',+ [+ '--context',+ context,+ '--request-timeout=15s',+ '-n',+ namespace,+ 'get',+ 'endpoints',+ service,+ '-o',+ 'jsonpath={range .subsets[*].addresses[*]}{.targetRef.name}{"\\n"}{end}',+ ],+ { encoding: 'utf8', timeout: 20_000, stdio: ['ignore', 'pipe', 'pipe'] }+ )+}++/**+ * The hosted dev cluster must really host the services the Desktop lane+ * drives, each with a ready endpoint.+ */+export function assertHostedDevServices(+ context: string,+ readEndpoints: HostedDevEndpointReader = kubectlEndpointTargets+): void {+ for (const [namespace, service] of HOSTED_DEV_SERVICES) {+ let output: string+ try {+ output = readEndpoints(context, namespace, service)+ } catch (err) {+ throw new Error(+ `[E2E-GUARD] hosted dev context=${context} has no readable endpoint for ${namespace}/${service}: ${(err as Error).message}`+ )+ }+ const ready = output+ .split('\n')+ .map(line => line.trim())+ .filter(Boolean)+ if (ready.length === 0) {+ throw new Error(+ `[E2E-GUARD] hosted dev context=${context} has no ready endpoint for ${namespace}/${service}.`+ )+ }+ }+}+async function assertHealth(baseUrl: string, label: string, path = '/health'): Promise<void> {let response: Responsetry {@@ -212,45 +279,69 @@ async function globalSetup(): Promise<void> {}const repoRoot = path.resolve(__dirname, '../../..')- const expectedHead = execFileSync('git', ['-C', repoRoot, 'rev-parse', 'HEAD'], {- encoding: 'utf8',- }).trim()- const expectedWorktreeId = createHash('sha1').update(repoRoot).digest('hex')- const marker = JSON.parse(- execFileSync(- 'kubectl',- [- '--context',- expected,- '-n',- 'control-plane',- 'get',- 'configmap',- 'clerum-pre-gate-sync-state',- '-o',- 'json',- ],- { encoding: 'utf8', timeout: 15_000 }- )- ) as { data?: Record<string, string> }- const markerData = marker.data ?? {}- if (!markerData.gitHead || !markerData.worktreeId || !markerData.clusterFingerprint) {+ const hostedDevContext = (process.env.E2E_HOSTED_DEV_CONTEXT || '').trim()+ const isHostedDev = hostedDevContext !== '' && hostedDevContext === expected+ if (hostedDevContext !== '' && !isHostedDev) {throw new Error(- `[E2E-GUARD] profile ${expected} has no complete pre-gate marker (gitHead/worktreeId/clusterFingerprint required).`+ `[E2E-GUARD] E2E_HOSTED_DEV_CONTEXT="${hostedDevContext}" does not match the selected context "${expected}".`)}- if (markerData.gitHead !== expectedHead || markerData.worktreeId !== expectedWorktreeId) {- throw new Error(- `[E2E-GUARD] profile marker does not belong to this worktree/head: ` +- `marker head=${markerData.gitHead} worktree=${markerData.worktreeId}, ` +- `expected head=${expectedHead} worktree=${expectedWorktreeId}.`- )- }- const expectedClusterFingerprint = process.env.E2E_EXPECTED_CLUSTER_FINGERPRINT?.trim()- if (expectedClusterFingerprint && markerData.clusterFingerprint !== expectedClusterFingerprint) {- throw new Error(- `[E2E-GUARD] profile marker cluster fingerprint ${markerData.clusterFingerprint} does not match E2E_EXPECTED_CLUSTER_FINGERPRINT ${expectedClusterFingerprint}.`- )++ if (isHostedDev) {+ // HOSTED DEV LANE. The Minikube branch-profile marker below proves that+ // a Minikube profile carries THIS worktree's HEAD. That marker only+ // exists for a Minikube branch profile, so it cannot be the guard for a+ // hosted cluster — and it must NOT be faked to make this lane green.+ // A hosted dev cluster is validated explicitly instead: the operator+ // names the context (E2E_HOSTED_DEV_CONTEXT), the context is on the+ // allow-list, the cluster really hosts the services this lane drives+ // with ready endpoints, and the lane reaches them through loopback+ // forwards only. Production stays hard-blocked by the checks above.+ assertHostedDevServices(expected)+ } else {+ const expectedHead = execFileSync('git', ['-C', repoRoot, 'rev-parse', 'HEAD'], {+ encoding: 'utf8',+ }).trim()+ const expectedWorktreeId = createHash('sha1').update(repoRoot).digest('hex')+ const marker = JSON.parse(+ execFileSync(+ 'kubectl',+ [+ '--context',+ expected,+ '-n',+ 'control-plane',+ 'get',+ 'configmap',+ 'clerum-pre-gate-sync-state',+ '-o',+ 'json',+ ],+ { encoding: 'utf8', timeout: 15_000 }+ )+ ) as { data?: Record<string, string> }+ const markerData = marker.data ?? {}+ if (!markerData.gitHead || !markerData.worktreeId || !markerData.clusterFingerprint) {+ throw new Error(+ `[E2E-GUARD] profile ${expected} has no complete pre-gate marker (gitHead/worktreeId/clusterFingerprint required).`+ )+ }+ if (markerData.gitHead !== expectedHead || markerData.worktreeId !== expectedWorktreeId) {+ throw new Error(+ `[E2E-GUARD] profile marker does not belong to this worktree/head: ` ++ `marker head=${markerData.gitHead} worktree=${markerData.worktreeId}, ` ++ `expected head=${expectedHead} worktree=${expectedWorktreeId}.`+ )+ }+ const expectedClusterFingerprint = process.env.E2E_EXPECTED_CLUSTER_FINGERPRINT?.trim()+ if (+ expectedClusterFingerprint &&+ markerData.clusterFingerprint !== expectedClusterFingerprint+ ) {+ throw new Error(+ `[E2E-GUARD] profile marker cluster fingerprint ${markerData.clusterFingerprint} does not match E2E_EXPECTED_CLUSTER_FINGERPRINT ${expectedClusterFingerprint}.`+ )+ }}const controlApi =@@ -276,7 +367,10 @@ async function globalSetup(): Promise<void> {process.env.WORKFLOW_APPROVAL_READER_URL ||'http://127.0.0.1:8098': undefined- const allowDevPortForward = parseBooleanEnv(process.env.E2E_ALLOW_DEV_PORT_FORWARD)+ // A hosted dev cluster is reached through loopback forwards, so that lane+ // REQUIRES localhost targets (never a public endpoint), the same rule the+ // explicit E2E_ALLOW_DEV_PORT_FORWARD switch applies elsewhere.+ const allowDevPortForward = parseBooleanEnv(process.env.E2E_ALLOW_DEV_PORT_FORWARD) || isHostedDevvalidateBaseUrls({expectedContext: expected,diff --git a/desktop-app/test/globalSetupGuard.test.ts b/desktop-app/test/globalSetupGuard.test.tsindex 687f0001a..899345e9d 100644--- a/desktop-app/test/globalSetupGuard.test.ts+++ b/desktop-app/test/globalSetupGuard.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest'import {ALLOWED_CONTEXTS,assertAllowedKubeContext,+ assertHostedDevServices,isLocalPortForwardContext,isProductionContext,validateBaseUrls,@@ -148,3 +149,36 @@ describe('assertAllowedKubeContext', () => {)})})++describe('assertHostedDevServices', () => {+ it('checks exactly the services the Desktop lane drives', () => {+ const asked: string[] = []+ assertHostedDevServices('dev', (_context, namespace, service) => {+ asked.push(`${namespace}/${service}`)+ return 'pod-1\n'+ })+ expect(asked).toEqual([+ 'control-plane/control-api',+ 'profiles/external-rest-api',+ 'rpc-proxy/rpc-proxy',+ ])+ })++ it('accepts a hosted dev context whose services have a ready endpoint', () => {+ expect(() => assertHostedDevServices('dev', () => 'pod-1\n')).not.toThrow()+ })++ it('refuses a service without a ready endpoint', () => {+ expect(() => assertHostedDevServices('dev', () => '\n')).toThrow(+ /hosted dev context=dev has no ready endpoint for control-plane\/control-api/+ )+ })++ it('refuses an unreadable service instead of starting a journey against it', () => {+ expect(() =>+ assertHostedDevServices('dev', () => {+ throw new Error('connection refused')+ })+ ).toThrow(/has no readable endpoint for control-plane\/control-api: connection refused/)+ })+})