mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-08 12:33:05 +01:00
Merge reviewed master readiness fixture correction
Include the already merged retention fixture correction from18984, preserving the Product TestOps implementation and original CI failure history. Co-Authored-By: Paperclip <noreply@paperclip.ing> * commit '04a24f4e06da68043378bdf3646f50292efd5316': test(recovery): align retained allocation fixture with readiness (#18984)
This commit is contained in:
commit
61ef7a6e42
1 file changed
+13
-3
@@ -11,7 +11,7 @@ import { appendHeartbeatRunEvent } from "../services/heartbeat-run-events.js";
|
|||||||
import { issueRecoveryActionService } from "../services/issue-recovery-actions.js";
|
import { issueRecoveryActionService } from "../services/issue-recovery-actions.js";
|
||||||
import { pinFailedObservedWorkspace } from "../services/native-runtime/native-observed-workspace-preservation.js";
|
import { pinFailedObservedWorkspace } from "../services/native-runtime/native-observed-workspace-preservation.js";
|
||||||
import { heartbeatService } from "../services/heartbeat.js";
|
import { heartbeatService } from "../services/heartbeat.js";
|
||||||
import { environmentRuntimeService, classifyEnvironmentCapabilities } from "../services/environment-runtime.js";
|
import { environmentRuntimeService, classifyEnvironmentCapabilities, type EnvironmentDriverResumeInput } from "../services/environment-runtime.js";
|
||||||
import { instanceSettingsService } from "../services/instance-settings.js";
|
import { instanceSettingsService } from "../services/instance-settings.js";
|
||||||
import { buildNativeExecutionInput } from "../services/native-runtime/native-execution-input.js";
|
import { buildNativeExecutionInput } from "../services/native-runtime/native-execution-input.js";
|
||||||
import { nativeRuntimeContextFixture } from "../services/native-runtime/runtime-context.test-fixture.js";
|
import { nativeRuntimeContextFixture } from "../services/native-runtime/runtime-context.test-fixture.js";
|
||||||
@@ -107,9 +107,11 @@ describeEmbeddedPostgres("heartbeat native remote preparation failure retention"
|
|||||||
expect(await pinFailedObservedWorkspace(db, companyId, f.runId)).toBe(false);
|
expect(await pinFailedObservedWorkspace(db, companyId, f.runId)).toBe(false);
|
||||||
throw preparationFailure;
|
throw preparationFailure;
|
||||||
});
|
});
|
||||||
|
const acquireAllocation = vi.fn(async () => { throw new Error("Unexpected new allocation"); });
|
||||||
|
const readyAllocation = vi.fn(async ({ lease }: EnvironmentDriverResumeInput) => lease);
|
||||||
const runtime = environmentRuntimeService(db, { drivers: [{ driver: "sandbox",
|
const runtime = environmentRuntimeService(db, { drivers: [{ driver: "sandbox",
|
||||||
acquireRunLease: async () => { throw new Error("Unexpected new allocation"); },
|
acquireRunLease: acquireAllocation,
|
||||||
resumeRunLease: async () => { throw new Error("Reattachment must not resume the allocation"); },
|
resumeRunLease: readyAllocation,
|
||||||
releaseRunLease: async () => { throw new Error("Unexpected destructive cleanup"); },
|
releaseRunLease: async () => { throw new Error("Unexpected destructive cleanup"); },
|
||||||
retryPendingSandboxTeardown: async () => { throw new Error("Stop must remain separately verified"); },
|
retryPendingSandboxTeardown: async () => { throw new Error("Stop must remain separately verified"); },
|
||||||
realizeWorkspace: async () => { throw new Error("Unexpected workspace realization"); },
|
realizeWorkspace: async () => { throw new Error("Unexpected workspace realization"); },
|
||||||
@@ -124,6 +126,14 @@ describeEmbeddedPostgres("heartbeat native remote preparation failure retention"
|
|||||||
nativeSessionBackendFactory: () => { throw new Error("No provider backend may be created"); } });
|
nativeSessionBackendFactory: () => { throw new Error("No provider backend may be created"); } });
|
||||||
await heartbeat.recoverNativeRunsAfterRestart(new Date(), [f.runId]);
|
await heartbeat.recoverNativeRunsAfterRestart(new Date(), [f.runId]);
|
||||||
await heartbeat.drainActiveRunExecutions();
|
await heartbeat.drainActiveRunExecutions();
|
||||||
|
expect(readyAllocation).toHaveBeenCalledExactlyOnceWith({
|
||||||
|
environment: expect.objectContaining({ id: environmentId }),
|
||||||
|
lease: expect.objectContaining({ id: leaseId, companyId, environmentId,
|
||||||
|
executionWorkspaceId: workspaceId, heartbeatRunId: f.runId, providerLeaseId,
|
||||||
|
status: "active", leasePolicy: "ephemeral" }),
|
||||||
|
requestedCwd: remoteCwd,
|
||||||
|
});
|
||||||
|
expect(acquireAllocation).not.toHaveBeenCalled();
|
||||||
expect(resumed).toHaveBeenCalledOnce();
|
expect(resumed).toHaveBeenCalledOnce();
|
||||||
const [run] = await db.select().from(heartbeatRuns).where(eq(heartbeatRuns.id, f.runId));
|
const [run] = await db.select().from(heartbeatRuns).where(eq(heartbeatRuns.id, f.runId));
|
||||||
expect(run.error).toBe(preparationFailure.message);
|
expect(run.error).toBe(preparationFailure.message);
|
||||||
|
|||||||
Reference in new issue
Block a user