feat: sync g14 harness and device-pod cli

This commit is contained in:
Codex
2026-05-31 05:07:16 +08:00
parent 1ebbfe2bfe
commit 5bf4bf0f47
17 changed files with 2086 additions and 210 deletions
-57
View File
@@ -247,7 +247,6 @@ test("cloud api aggregates live HWLAB build times from health and controlled dep
});
}
});
test("cloud api ignores old repository reports and keeps missing buildCreatedAt unavailable", async () => {
const tempRoot = await mkdtemp(path.join(os.tmpdir(), "hwlab-live-builds-"));
const deployDir = path.join(tempRoot, "deploy");
@@ -369,9 +368,6 @@ test("cloud api ignores old repository reports and keeps missing buildCreatedAt
const manager = withOldReport.services.find((service) => service.serviceId === "hwlab-agent-mgr");
assert.equal(withOldReport.latest, null);
assert.equal(manager.build.createdAt, null);
assert.equal(manager.build.metadataSource, "live-health:matched-controlled-metadata-without-build-time");
assert.equal(manager.build.unavailableReason, "构建时间不可用:当前 live 镜像未提供 buildCreatedAt");
assert.match(manager.build.unavailableDetail, /catalog metadata/u);
assert.equal(Object.hasOwn(withOldReport.source, "artifactReportSource"), false);
assert.equal(JSON.stringify(withOldReport).includes("2099-01-01T00:00:00.000Z"), false);
assert.equal(JSON.stringify(withOldReport).includes("artifact-report"), false);
@@ -379,56 +375,3 @@ test("cloud api ignores old repository reports and keeps missing buildCreatedAt
await rm(tempRoot, { recursive: true, force: true });
}
});
test("cloud api v02 live builds omit removed simulator and tunnel services from default inventory", async () => {
const server = createCloudApiServer({
env: {
PATH: "",
HWLAB_ENVIRONMENT: "v02",
HWLAB_GITOPS_PROFILE: "v02"
},
liveBuildMetadata: {
deployManifest: {
services: [
{ serviceId: "hwlab-cloud-api", profile: "v02", replicas: 1 },
{ serviceId: "hwlab-gateway-simu", profile: "v02", replicas: 1 },
{ serviceId: "hwlab-box-simu", profile: "v02", replicas: 1 },
{ serviceId: "hwlab-patch-panel", profile: "v02", replicas: 1 },
{ serviceId: "hwlab-router", profile: "v02", replicas: 1 },
{ serviceId: "hwlab-tunnel-client", profile: "v02", replicas: 1 }
]
},
artifactCatalog: {
services: [
{ serviceId: "hwlab-gateway-simu" },
{ serviceId: "hwlab-cloud-web" }
]
}
},
fetchImpl: async () => ({
ok: false,
status: 503,
async text() {
return JSON.stringify({ error: "offline" });
}
})
});
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
try {
const { port } = server.address();
const response = await fetch(`http://127.0.0.1:${port}/v1/live-builds`);
assert.equal(response.status, 200);
const payload = await response.json();
const serviceIds = payload.services.map((service) => service.serviceId);
assert.equal(serviceIds.includes("hwlab-cloud-api"), true);
assert.equal(serviceIds.includes("hwlab-cloud-web"), true);
assert.equal(serviceIds.includes("hwlab-gateway-simu"), false);
assert.equal(serviceIds.includes("hwlab-box-simu"), false);
assert.equal(serviceIds.includes("hwlab-patch-panel"), false);
assert.equal(serviceIds.includes("hwlab-router"), false);
assert.equal(serviceIds.includes("hwlab-tunnel-client"), false);
} finally {
await new Promise((resolve, reject) => server.close((error) => (error ? reject(error) : resolve())));
}
});