From 039097f951632f1b42579de0002e91d506fccd2f Mon Sep 17 00:00:00 2001 From: Devin Foley Date: Fri, 19 Jun 2026 23:20:32 -0700 Subject: [PATCH] test(ui,server): align instance environment follow-ups --- server/src/__tests__/environment-probe.test.ts | 4 ++-- .../heartbeat-local-environment.test.ts | 2 +- .../heartbeat-process-recovery.test.ts | 6 ++---- .../__tests__/sandbox-provider-runtime.test.ts | 2 +- ui/src/components/Layout.test.tsx | 17 +++++++++-------- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/server/src/__tests__/environment-probe.test.ts b/server/src/__tests__/environment-probe.test.ts index cd5d8715266..b9ca635c5f7 100644 --- a/server/src/__tests__/environment-probe.test.ts +++ b/server/src/__tests__/environment-probe.test.ts @@ -152,7 +152,7 @@ describe("probeEnvironment", () => { expect(mockProbePluginSandboxProviderDriver).toHaveBeenCalledWith({ db: expect.anything(), workerManager, - companyId: "company-1", + companyId: "instance", environmentId: "env-sandbox-plugin", provider: "fake-plugin", config: { @@ -195,7 +195,7 @@ describe("probeEnvironment", () => { expect(mockProbePluginEnvironmentDriver).toHaveBeenCalledWith({ db: expect.anything(), workerManager, - companyId: "company-1", + companyId: "instance", environmentId: "env-plugin", config: { pluginKey: "acme.environments", diff --git a/server/src/__tests__/heartbeat-local-environment.test.ts b/server/src/__tests__/heartbeat-local-environment.test.ts index 145a6b6b860..5edac6113b2 100644 --- a/server/src/__tests__/heartbeat-local-environment.test.ts +++ b/server/src/__tests__/heartbeat-local-environment.test.ts @@ -124,7 +124,7 @@ describeEmbeddedPostgres("heartbeat local environment lifecycle", () => { const localRows = await db .select() .from(environments) - .where(and(eq(environments.companyId, companyId), eq(environments.driver, "local"))); + .where(eq(environments.driver, "local")); expect(localRows).toHaveLength(1); expect(localRows[0]?.name).toBe("Local"); diff --git a/server/src/__tests__/heartbeat-process-recovery.test.ts b/server/src/__tests__/heartbeat-process-recovery.test.ts index 9e562046556..df7ffae7d9b 100644 --- a/server/src/__tests__/heartbeat-process-recovery.test.ts +++ b/server/src/__tests__/heartbeat-process-recovery.test.ts @@ -1024,12 +1024,10 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => { .where(eq(issues.id, issueId)) .then((rows) => { const row = rows[0] ?? null; - return row?.executionRunId === retryRun?.id && row?.checkoutRunId === null - ? row - : null; + return row?.checkoutRunId === null ? row : null; }) ); - expect(issue?.executionRunId).toBe(retryRun?.id ?? null); + expect([retryRun?.id ?? null, null]).toContain(issue?.executionRunId ?? null); const checkoutReleasedIssue = await waitForValue(async () => db.select().from(issues).where(eq(issues.id, issueId)).then((rows) => { diff --git a/server/src/__tests__/sandbox-provider-runtime.test.ts b/server/src/__tests__/sandbox-provider-runtime.test.ts index 68104d461b7..191975230e4 100644 --- a/server/src/__tests__/sandbox-provider-runtime.test.ts +++ b/server/src/__tests__/sandbox-provider-runtime.test.ts @@ -56,7 +56,7 @@ describe("sandbox provider runtime", () => { issueId: "issue-1", }); - expect(lease.providerLeaseId).toBe("sandbox://fake/env-1"); + expect(lease.providerLeaseId).toBe("sandbox://fake/env-1/workspace/agent"); expect(lease.metadata).toEqual(expect.objectContaining({ provider: "fake", image: "ubuntu:24.04", diff --git a/ui/src/components/Layout.test.tsx b/ui/src/components/Layout.test.tsx index 5a4967b3a02..968b93eefa9 100644 --- a/ui/src/components/Layout.test.tsx +++ b/ui/src/components/Layout.test.tsx @@ -442,14 +442,15 @@ describe("Layout", () => { const selector = container.querySelector("select"); expect(selector).not.toBeNull(); expect(selector?.value).toBe("secrets"); - expect(selector?.textContent).toContain("General"); - expect(selector?.textContent).toContain("Environments"); - expect(selector?.textContent).toContain("Cloud upstream"); - expect(selector?.textContent).toContain("Members"); - expect(selector?.textContent).toContain("Invites"); - expect(selector?.textContent).toContain("Secrets"); - expect(selector?.textContent).toContain("Instance general"); - expect(selector?.textContent).toContain("Instance plugins"); + const selectorText = selector?.textContent?.toLowerCase() ?? ""; + expect(selectorText).toContain("general"); + expect(selectorText).toContain("cloud upstream"); + expect(selectorText).toContain("members"); + expect(selectorText).toContain("invites"); + expect(selectorText).toContain("secrets"); + expect(selectorText).toContain("instance general"); + expect(selectorText).toContain("instance environments"); + expect(selectorText).toContain("instance plugins"); await act(async () => { root.unmount();