Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Remove unnecessary stops of httpd in tests
Thomas Scholtes committed 1 year ago
commit 04de7e7526ef69896a00515a40c7f106455a18b7
parent 3b1b4a5b3804d39fbe8a4cf40562a9928c043ed9
3 files changed +4 -25
modified httpd-client/tests/support/fixtures.ts
@@ -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();
  },
});
modified tests/e2e/node.spec.ts
@@ -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 }) => {
modified tests/support/peerManager.ts
@@ -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 {