summaryrefslogtreecommitdiff
path: root/extension/src/test-suite/environmentSetup.test.ts
blob: 59d9f6bb082dcc66f6c0f7b56d30a549feddb237 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { test, describe } from "mocha";
import * as assert from "assert";

import { getContinueServerUrl } from "../bridge";
import fetch from "node-fetch";

describe("Can start python server", () => {
  test("Can start python server in under 35 seconds", async function () {
    const allowedTime = 25_000;
    this.timeout(allowedTime + 10_000);
    // try {
    //   fkill(65432, { force: true });
    //   console.log("Killed existing server");
    // } catch (e) {
    //   console.log("No existing server: ", e);
    // }

    // If successful, the server is started by the extension while we wait
    await new Promise((resolve) => setTimeout(resolve, allowedTime));

    // Check if server is running
    const serverUrl = getContinueServerUrl();
    console.log("Server URL: ", serverUrl);
    const response = await fetch(`${serverUrl}/health`);
    assert.equal(response.status, 200);
  });
});