Files
openworker/deploy/service/local-drain.test.mjs
Rohit PrasadandDevika Verma d53e058eda Introduce OpenWorker Harness SDK (in beta), agent service cluster and relevant developer documentation (#844)
Allow developers to easily build AI apps without worrying about the harness part.
Bundles the Rust agent runtime as a SDK (Rust and TypeScript) for building desktop and web applications. Applications can manage a local harness or connect to an authenticated harness service on k8s with separately scaled workers and sandbox execution.

The implementation is primarily contained in harness/, with deployment tooling in deploy/, Markdown guides in docs/harness/guides/, and the static documentation site in docs-site/. It does not replace the existing Python harness or migrate OpenWorker Desktop.

Co-authored-by: Devika Verma <devikaverma11@gmail.com>
2026-11-06 09:45:20 -08:00

42 lines
1.1 KiB
JavaScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { waitForEmptyPods } from "./local-drain.mjs";
test("cleanup accepts API pods that already disappeared without kubectl wait on an empty selector", async () => {
let reads = 0;
await waitForEmptyPods(
async () => {
reads++;
return { items: [] };
},
{ timeoutMs: 0 },
);
assert.equal(reads, 1);
});
test("cleanup waits for terminating API pods and does not treat API failure as deletion", async () => {
let reads = 0;
await waitForEmptyPods(
async () => ({
items:
++reads === 1 ? [{ metadata: { deletionTimestamp: "pending" } }] : [],
}),
{ intervalMs: 0 },
);
assert.equal(reads, 2);
await assert.rejects(
waitForEmptyPods(async () => {
throw Error("API unavailable");
}),
/API unavailable/,
);
await assert.rejects(
waitForEmptyPods(async () => ({})),
/Invalid pod-list/,
);
});
test("cleanup stops at its deadline while an API pod remains", async () => {
await assert.rejects(
waitForEmptyPods(async () => ({ items: [{}] }), { timeoutMs: 0 }),
/deadline/,
);
});