Skip to content

Commit 43c5a2b

Browse files
YunchuWangCopilot
andcommitted
test(functions-e2e): drop ping.ts, use /admin/host/status readiness probe
The ping.ts HTTP trigger was not part of the extension's BasicNode app; it only backed the harness readiness probe. Switch the harness to poll the func host's /admin/host/status endpoint for state == "Running" (matching the extension's C# FunctionAppProcess fixture) and remove ping.ts so the test-app is a faithful BasicNode port. Addresses PR review feedback. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e718bd1c-581f-4a9a-995a-62d4a38bbc86
1 parent 2963134 commit 43c5a2b

3 files changed

Lines changed: 17 additions & 23 deletions

File tree

test/e2e-functions/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ tests are `it.skip` with a comment citing the same reason.
8787
- Node swallows suspend/resume/terminate of a **terminal** instance and returns
8888
success (`200`); the specs assert that behavior.
8989

90-
The test-app additions over `BasicNode` are a plain `/api/ping` readiness function
91-
(for host-readiness probing) and the published-dependency wiring. The Durable
92-
function code is otherwise kept close to the source app.
90+
The only test-app deviation from `BasicNode` is the published-dependency wiring
91+
(see `test-app/package.json`); the Durable function code is otherwise kept close
92+
to the source app. Host readiness is detected by polling `/admin/host/status`
93+
for `state == "Running"`, the same way the extension's C# `FunctionAppProcess`
94+
fixture does.
9395

9496
## Running locally
9597

test/e2e-functions/harness.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* ({ id, statusQueryGetUri, ... }); client-operation triggers (RaiseEvent,
2121
* SuspendInstance, TerminateInstance, ...) return their own status/body.
2222
* - GET {statusQueryGetUri} -> poll orchestration status.
23-
* - GET /api/ping -> plain readiness probe.
23+
* - GET /admin/host/status -> host readiness probe.
2424
*/
2525

2626
import { ChildProcess, spawn, spawnSync } from "child_process";
@@ -268,7 +268,8 @@ const FATAL_LOG_MARKERS = [
268268
/**
269269
* Manages the lifecycle of a `func start` host for the sample app.
270270
*
271-
* `start()` launches the host and blocks until `/api/ping` responds; `stop()`
271+
* `start()` launches the host and blocks until `/admin/host/status` reports
272+
* `Running`; `stop()`
272273
* terminates the whole process tree and surfaces the captured host log if
273274
* startup failed.
274275
*/
@@ -360,19 +361,24 @@ export class FunctionApp {
360361

361362
private async _waitUntilReady(): Promise<void> {
362363
const deadline = Date.now() + HOST_STARTUP_TIMEOUT_MS;
363-
const pingUrl = `${this.baseUrl}/api/ping`;
364+
// Mirrors the extension's C# `FunctionAppProcess`: poll the host's admin
365+
// status endpoint until it reports `state == "Running"`.
366+
const statusUrl = `${this.baseUrl}/admin/host/status`;
364367
while (Date.now() < deadline) {
365368
if (this._exited) {
366369
throw new Error(`Functions host exited early.\n${this._readLog()}`);
367370
}
368371
this._checkLogForFatalErrors();
369372
try {
370-
const result = await httpRequest("GET", pingUrl, undefined, 5000);
373+
const result = await httpRequest("GET", statusUrl, undefined, 5000);
371374
if (result.status === 200) {
372-
return;
375+
const state = (JSON.parse(result.body) as { state?: string }).state;
376+
if (state === "Running") {
377+
return;
378+
}
373379
}
374380
} catch {
375-
// Host is not accepting connections yet.
381+
// Host is not accepting connections / not fully started yet.
376382
}
377383
await sleep(1000);
378384
}

test/e2e-functions/test-app/src/functions/ping.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)