Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
boronine committed Oct 14, 2024
1 parent baa6145 commit 3a125ea
Show file tree
Hide file tree
Showing 2 changed files with 215 additions and 141 deletions.
6 changes: 4 additions & 2 deletions src/h2tunnel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const clientOptions: ClientOptions = {
cert: CLIENT_CRT,
localHttpPort: LOCAL_HTTP_PORT,
demuxListenPort: DEMUX_PORT,
tunnelRestartTimeout: 200,
tunnelRestartTimeout: 500,
};

async function expect503() {
Expand All @@ -126,6 +126,7 @@ async function expect200() {
headers: { "x-increment": "2" },
});
const body = await resp.text();
assert.strictEqual(resp.status, 200);
assert.strictEqual(body, "2");
assert.strictEqual(resp.headers.get("x-incremented"), "3");
}
Expand All @@ -139,14 +140,14 @@ test("happy-path", async () => {
await expect503();

await tunnelServer.waitUntilListening();

let tunnelClient = new TunnelClient(clientOptions);

// Make a request too early
await expect503();

// Wait until client is connected and test 200
await tunnelClient.waitUntilConnected();
await tunnelServer.waitUntilConnected();
await expect200();

// Restart server while client is running
Expand All @@ -156,6 +157,7 @@ test("happy-path", async () => {

// Make sure client reconnected and request succeeds
await tunnelClient.waitUntilConnected();
await tunnelServer.waitUntilConnected();
await expect200();

// Restart client while server is running
Expand Down
Loading

0 comments on commit 3a125ea

Please sign in to comment.