Skip to content

Commit

Permalink
fix: mitigate denoland/deno_core#762 (#377)
Browse files Browse the repository at this point in the history
* fix: patch dependency

* chore: update `Cargo.lock`

* chore: add an integration test for forced redirects for specifiers
  • Loading branch information
nyannyacha authored Jun 25, 2024
1 parent c8fc7ac commit 107f27d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 9 deletions.
9 changes: 3 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ http = "0.2"
faster-hex = "0.9.0"
tracing = "0.1"

# DEBUG
# [patch.crates-io]
# deno_core = { path = "/Users/andrespirela/Documents/workspace/supabase/deno_core/core" }
[patch.crates-io]
# TODO(Nyannyacha): Patch below is temporary. Clean the line in the Deno 1.44 update.
deno_core = { git = "https://github.com/supabase/deno_core", branch = "278-supabase" }

[profile.dind]
inherits = "dev"
Expand Down
11 changes: 11 additions & 0 deletions crates/base/test_cases/concurrent-redirect/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// NOTE(Nyannyacha): This is the same test case as described in denoland/deno_core#762, but it is a
// minimal reproducible sample of what happens in the field.
//
// `@1.x` suffixes cause forced redirects for specifiers.

import * as A from "https://lib.deno.dev/x/[email protected]/mod.ts";
import * as B from "https://lib.deno.dev/x/[email protected]/types.ts";

console.log(A, B);

Deno.serve((_req) => new Response("meow"));
25 changes: 25 additions & 0 deletions crates/base/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,31 @@ async fn test_request_idle_timeout_websocket_node_secure() {
test_request_idle_timeout_websocket_deno(new_localhost_tls(true), true).await;
}

#[tokio::test]
#[serial]
async fn test_should_not_hang_when_forced_redirection_for_specifiers() {
let (tx, rx) = oneshot::channel::<()>();

integration_test!(
"./test_cases/main",
NON_SECURE_PORT,
"concurrent-redirect",
None,
None,
None,
None,
(|resp| async {
assert_eq!(resp.unwrap().status().as_u16(), 200);
tx.send(()).unwrap();
}),
TerminationToken::new()
);

if timeout(Duration::from_secs(10), rx).await.is_err() {
panic!("failed to check within 10 seconds");
}
}

trait AsyncReadWrite: AsyncRead + AsyncWrite + Send + Unpin {}

impl<T> AsyncReadWrite for T where T: AsyncRead + AsyncWrite + Send + Unpin {}
Expand Down

0 comments on commit 107f27d

Please sign in to comment.