fix(hwlab-node): stabilize tray diagnostics updater
This commit is contained in:
@@ -21,6 +21,7 @@ test("cloud-api exposes hwpod-node-ops contract on /v1", async () => {
|
||||
assert.ok(payload.hwpod.supportedOps.includes("workspace.ls"));
|
||||
assert.ok(payload.hwpod.supportedOps.includes("workspace.insert-after"));
|
||||
assert.equal(payload.hwlabNode.updateRoute, "/v1/hwlab-node/update");
|
||||
assert.equal(payload.hwlabNode.downloadRoute, "/v1/hwlab-node/download/hwlab-node.py");
|
||||
assert.equal(payload.hwlabNode.updateContractVersion, "hwlab-node-update-v1");
|
||||
} finally {
|
||||
await close(server);
|
||||
@@ -59,6 +60,28 @@ test("cloud-api exposes hwlab-node Python update metadata", async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("cloud-api serves bundled hwlab-node Python updater artifact by default", async () => {
|
||||
const server = createCloudApiServer({ env: { PATH: process.env.PATH, HWLAB_PUBLIC_ENDPOINT: "https://hwlab.pikapython.com" } });
|
||||
await listen(server);
|
||||
try {
|
||||
const response = await fetch(`${serverUrl(server)}/v1/hwlab-node/update?current=0.1.0&channel=stable&platform=windows`);
|
||||
const payload = await response.json();
|
||||
assert.equal(response.status, 200);
|
||||
assert.equal(payload.updateAvailable, true);
|
||||
assert.equal(payload.latestVersion, "0.1.1");
|
||||
assert.equal(payload.downloadUrl, "https://hwlab.pikapython.com/v1/hwlab-node/download/hwlab-node.py");
|
||||
assert.match(payload.sha256, /^[a-f0-9]{64}$/u);
|
||||
|
||||
const download = await fetch(`${serverUrl(server)}/v1/hwlab-node/download/hwlab-node.py`);
|
||||
const text = await download.text();
|
||||
assert.equal(download.status, 200);
|
||||
assert.equal(download.headers.get("x-hwlab-node-version"), "0.1.1");
|
||||
assert.ok(text.includes('APP_VERSION = "0.1.1"'));
|
||||
} finally {
|
||||
await close(server);
|
||||
}
|
||||
});
|
||||
|
||||
test("cloud-api discovers preinstalled workspace hwpod-specs without hardcoded device constants", async () => {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "hwlab-hwpod-spec-discovery-"));
|
||||
const specDir = path.join(root, ".hwlab");
|
||||
|
||||
Reference in New Issue
Block a user