From 39eb431f6f64de1906cb4d2c6a1b7d4ab2db3f71 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 11 Sep 2024 15:51:08 +0200 Subject: [PATCH] fix --- tests/integration/js_unit_tests.rs | 15 +++++++++++++-- tests/integration/node_unit_tests.rs | 9 ++++----- tests/unit/net_test.ts | 4 ++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/tests/integration/js_unit_tests.rs b/tests/integration/js_unit_tests.rs index 3e80761ee52496..ff66b914aa57e8 100644 --- a/tests/integration/js_unit_tests.rs +++ b/tests/integration/js_unit_tests.rs @@ -145,10 +145,21 @@ fn js_unit_test(test: String) { } // Some tests require the root CA cert file to be loaded. - if test == "websocket_test" || test == "tls_sni_test" { - deno = deno.arg("--cert=./cli/tests/tls/RootCA.pem") + if test == "websocket_test" { + deno = deno.arg(format!( + "--cert={}", + util::testdata_path() + .join("tls") + .join("RootCA.pem") + .to_string_lossy() + )); }; + if test == "tls_sni_test" { + // TODO(lucacasonato): fix the SNI in the certs so that this is not needed + deno = deno.arg("--unsafely-ignore-certificate-errors"); + } + let mut deno = deno .arg("-A") .arg(util::tests_path().join("unit").join(format!("{test}.ts"))) diff --git a/tests/integration/node_unit_tests.rs b/tests/integration/node_unit_tests.rs index 0a5b78f7f4ab73..25383b270cd5ae 100644 --- a/tests/integration/node_unit_tests.rs +++ b/tests/integration/node_unit_tests.rs @@ -117,16 +117,15 @@ fn node_unit_test(test: String) { .arg("-A"); // Some tests require the root CA cert file to be loaded. - deno = if test == "http2_test" { - deno.arg("--cert=./cli/tests/tls/RootCA.pem") - } else { - deno - }; + if test == "http2_test" || test == "http_test" { + deno = deno.arg("--cert=./tests/testdata/tls/RootCA.pem"); + } // Parallel tests for crypto if test.starts_with("crypto/") { deno = deno.arg("--parallel"); } + let mut deno = deno .arg( util::tests_path() diff --git a/tests/unit/net_test.ts b/tests/unit/net_test.ts index 79767275479d40..afcfc369cb7cbd 100644 --- a/tests/unit/net_test.ts +++ b/tests/unit/net_test.ts @@ -166,7 +166,7 @@ Deno.test( } else if (e.message === "Another accept task is ongoing") { acceptErrCount++; } else { - throw new Error("Unexpected error message"); + throw e; } }; const p = listener.accept().catch(checkErr); @@ -188,7 +188,7 @@ Deno.test( const listener = Deno.listen({ transport: "unix", path: filePath }); let acceptErrCount = 0; const checkErr = (e: Error) => { - if (e.message === "Listener has been closed") { + if (e.message === "operation canceled") { assertEquals(acceptErrCount, 1); } else if (e instanceof Deno.errors.Busy) { // "Listener already in use" acceptErrCount++;