Update relay-handling logic and test assertions for device binding and local IP resolution
- Correct test cases to ensure proper relay IDs are switched. - Add robust local IP resolution for relay-device bindings, including caching and inventory backfill. - Introduce fast-path options for relay status and switch dispatch. - Validate PHP extensions (`curl`, `sqlite3`) in edge agent images.
This commit is contained in:
@@ -120,6 +120,23 @@ test("relay status and switch commands support both Shelly RPC and legacy endpoi
|
||||
assert.equal(switched.on, false);
|
||||
});
|
||||
|
||||
test("relay switch commands fail quickly when the local Shelly request stalls", async () => {
|
||||
let calls = 0;
|
||||
const hangingFetch = async () => {
|
||||
calls += 1;
|
||||
return new Promise(() => {});
|
||||
};
|
||||
const startedAt = Date.now();
|
||||
|
||||
await assert.rejects(
|
||||
() => setRelayState({ localIp: "10.1.0.31", channel: 0, on: true, timeoutMs: 50 }, hangingFetch),
|
||||
/HTTP request timed out after 50ms/
|
||||
);
|
||||
|
||||
assert.equal(calls, 1);
|
||||
assert.ok(Date.now() - startedAt < 500);
|
||||
});
|
||||
|
||||
test("runUpdate stages a pending verification restart after installing new artifacts", async () => {
|
||||
const tempDir = await mkdtemp(path.join(os.tmpdir(), "edge-agent-update-"));
|
||||
const configPath = path.join(tempDir, "config.json");
|
||||
|
||||
Reference in New Issue
Block a user