Skip to content

Commit 5fc7f0a

Browse files
authored
chore: add an integration test for supabase/supabase#29583 (#508)
1 parent 01094be commit 5fc7f0a

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// https://github.com/seanmonstar/deno/blob/main/tests/unit_node/http2_test.ts#L115
2+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
3+
4+
import * as http2 from "node:http2";
5+
import { assert, assertEquals } from "jsr:@std/assert";
6+
7+
const clientSession = http2.connect("https://www.example.com");
8+
const req = clientSession.request({
9+
":method": "GET",
10+
":path": "/",
11+
});
12+
let headers = {};
13+
let status: number | undefined = 0;
14+
let chunk = new Uint8Array();
15+
const endPromise = Promise.withResolvers<void>();
16+
req.on("response", (h) => {
17+
status = h[":status"];
18+
headers = h;
19+
});
20+
req.on("data", (c) => {
21+
chunk = c;
22+
});
23+
req.on("end", () => {
24+
clientSession.close();
25+
req.close();
26+
endPromise.resolve();
27+
});
28+
req.end();
29+
await endPromise.promise;
30+
assert(Object.keys(headers).length > 0);
31+
assertEquals(status, 200);
32+
assert(chunk.length > 0);
33+
assert(clientSession.socket);
34+
35+
export default {
36+
fetch() {
37+
return new Response(null);
38+
},
39+
};

crates/base/tests/integration_tests.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,24 @@ async fn test_issue_456() {
23492349
tb.exit(Duration::from_secs(TESTBED_DEADLINE_SEC)).await;
23502350
}
23512351

2352+
#[tokio::test]
2353+
#[serial]
2354+
async fn test_supabase_issue_29583() {
2355+
integration_test!(
2356+
"./test_cases/main",
2357+
NON_SECURE_PORT,
2358+
"supabase-issue-29583",
2359+
None,
2360+
None,
2361+
None,
2362+
(|resp| async {
2363+
let resp = resp.unwrap();
2364+
assert_eq!(resp.status().as_u16(), StatusCode::OK);
2365+
}),
2366+
TerminationToken::new()
2367+
);
2368+
}
2369+
23522370
#[tokio::test]
23532371
#[serial]
23542372
async fn test_should_render_detailed_failed_to_create_graph_error() {

0 commit comments

Comments
 (0)