Merge branch 'codex/work-folders-runtime-hardening-refresh' into codex/work-folders-staging-hardening-refresh
* codex/work-folders-runtime-hardening-refresh: test(daytona): preserve reusable work after stop failure
This commit is contained in:
commit
3bf457c208
|
|
@ -1330,16 +1330,16 @@ describe("Daytona sandbox provider plugin", () => {
|
|||
expect(sandbox.stop).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not acknowledge termination when both provider stop and delete fail", async () => {
|
||||
it("does not acknowledge termination or delete a reusable sandbox when stopping fails", async () => {
|
||||
process.env.DAYTONA_API_KEY = "host-key";
|
||||
const sandbox = createMockSandbox({ id: "sandbox-failed-stop", state: "started" });
|
||||
sandbox.stop.mockRejectedValueOnce(new Error("stop failed"));
|
||||
sandbox.delete.mockRejectedValueOnce(new Error("delete failed"));
|
||||
mockGet.mockResolvedValue(sandbox);
|
||||
await expect(plugin.definition.onEnvironmentReleaseLease?.({
|
||||
driverKey: "daytona", companyId: "company-1", environmentId: "env-1",
|
||||
providerLeaseId: sandbox.id, config: { reuseLease: true },
|
||||
})).rejects.toThrow("delete failed");
|
||||
})).rejects.toThrow("stop failed");
|
||||
expect(sandbox.delete).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("stops reusable leases and deletes ephemeral leases on release", async () => {
|
||||
|
|
@ -1707,8 +1707,7 @@ describe("Daytona sandbox provider plugin", () => {
|
|||
it("deletes the session at destroy even when the sandbox delete throws", async () => {
|
||||
process.env.DAYTONA_API_KEY = "host-key";
|
||||
const sandbox = createMockSandbox();
|
||||
sandbox.delete.mockRejectedValueOnce(new Error("delete failed"));
|
||||
mockGet.mockResolvedValue(sandbox);
|
||||
mockGet.mockResolvedValue(sandbox);
|
||||
|
||||
await plugin.definition.onEnvironmentExecute?.(sessionExecParams());
|
||||
const sessionId = sandbox.process.createSession.mock.calls[0]![0] as string;
|
||||
|
|
|
|||
Loading…
Reference in New Issue