Remove unnecessary stops of httpd in tests

This commit is contained in:
Thomas Scholtes
2024-05-27 09:21:08 +02:00
parent 3b1b4a5b38
commit 04de7e7526
3 changed files with 4 additions and 25 deletions
+1 -1
View File
@@ -27,6 +27,6 @@ export const testFixture = test.extend<TestFixtures>({
await peer.startHttpd();
const api = new HttpdClient(peer.httpdBaseUrl);
await use({ api, peer });
await peer.stopHttpd();
await peer.shutdown();
},
});
-2
View File
@@ -20,8 +20,6 @@ test("node metadata", async ({ page, peerManager }) => {
page.getByText(`${shortNodeRemote}@seed.radicle.test:8123`),
).toBeVisible();
await expect(page.getByText("1.0.0-rc.8-")).toBeVisible();
await peer.stopHttpd();
await peer.stopNode();
});
test("node projects", async ({ page }) => {
+3 -22
View File
@@ -172,7 +172,6 @@ export class RadiclePeer {
#listenSocketAddr?: string;
#httpdBaseUrl?: BaseUrl;
#nodeProcess?: ExecaChildProcess;
#httpdProcess?: ExecaChildProcess;
// Name for easy identification. Used on file system and in logs.
#name: string;
#childProcesses: ExecaChildProcess[] = [];
@@ -266,7 +265,7 @@ export class RadiclePeer {
port,
scheme: "http",
};
this.#httpdProcess = this.spawn("radicle-httpd", [
void this.spawn("radicle-httpd", [
"--listen",
`${this.#httpdBaseUrl.hostname}:${this.#httpdBaseUrl.port}`,
]);
@@ -279,23 +278,6 @@ export class RadiclePeer {
});
}
public async stopHttpd() {
if (!this.#httpdBaseUrl || !this.#httpdProcess) {
return;
}
this.#httpdProcess.kill("SIGTERM");
await waitOn({
resources: [
`tcp:${this.#httpdBaseUrl.hostname}:${this.#httpdBaseUrl.port}`,
],
reverse: true,
timeout: 2000,
});
this.#httpdBaseUrl = undefined;
}
public async startNode(nodeParams: Partial<NodeConfig["node"]> = {}) {
const listenPort = await getPort();
this.#listenSocketAddr = `0.0.0.0:${listenPort}`;
@@ -355,14 +337,13 @@ export class RadiclePeer {
}
/**
* Kill all child processes created with `spawn()`, the node process and the
* HTTP API process.
* Kill all child processes created with `spawn()`, including the node and
* httpd processes.
*/
public async shutdown() {
// We don’t care about proper cleanup. We just want to make sure that no
// processes are running anymore.
this.#childProcesses.forEach(p => p.kill("SIGKILL"));
await Promise.all([this.stopNode(), this.stopHttpd()]);
}
public get address(): string {