summaryrefslogtreecommitdiff
path: root/tests/util/server/src/servers
diff options
context:
space:
mode:
authorMarvin Hagemeister <marvin@deno.com>2024-10-24 20:03:56 +0200
committerGitHub <noreply@github.com>2024-10-24 20:03:56 +0200
commit5f0bb3c6f4328003012e98ba70ce18e4e2e842de (patch)
tree5d99b6f2868c70b105ca4ff83f2a7380f4da9ac5 /tests/util/server/src/servers
parentc71e020668b40666aecfdffb1dbf979abcb41958 (diff)
fix: `.npmrc` settings not being passed to install/add command (#26473)
We weren't passing the resolved npmrc settings to the install commands. This lead us to always fall back to the default registry url instead of using the one from npmrc. Fixes https://github.com/denoland/deno/issues/26139 Fixes https://github.com/denoland/deno/issues/26033 Fixes https://github.com/denoland/deno/issues/25924 Fixes https://github.com/denoland/deno/issues/25822 Fixes https://github.com/denoland/deno/issues/26152 --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'tests/util/server/src/servers')
-rw-r--r--tests/util/server/src/servers/mod.rs4
-rw-r--r--tests/util/server/src/servers/npm_registry.rs15
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/util/server/src/servers/mod.rs b/tests/util/server/src/servers/mod.rs
index 3e18aafce..3a9c44010 100644
--- a/tests/util/server/src/servers/mod.rs
+++ b/tests/util/server/src/servers/mod.rs
@@ -91,6 +91,7 @@ const PROVENANCE_MOCK_SERVER_PORT: u16 = 4251;
pub(crate) const PUBLIC_NPM_REGISTRY_PORT: u16 = 4260;
pub(crate) const PRIVATE_NPM_REGISTRY_1_PORT: u16 = 4261;
pub(crate) const PRIVATE_NPM_REGISTRY_2_PORT: u16 = 4262;
+pub(crate) const PRIVATE_NPM_REGISTRY_3_PORT: u16 = 4263;
// Use the single-threaded scheduler. The hyper server is used as a point of
// comparison for the (single-threaded!) benchmarks in cli/bench. We're not
@@ -143,6 +144,8 @@ pub async fn run_all_servers() {
npm_registry::private_npm_registry1(PRIVATE_NPM_REGISTRY_1_PORT);
let private_npm_registry_2_server_futs =
npm_registry::private_npm_registry2(PRIVATE_NPM_REGISTRY_2_PORT);
+ let private_npm_registry_3_server_futs =
+ npm_registry::private_npm_registry3(PRIVATE_NPM_REGISTRY_3_PORT);
let mut futures = vec![
redirect_server_fut.boxed_local(),
@@ -173,6 +176,7 @@ pub async fn run_all_servers() {
futures.extend(npm_registry_server_futs);
futures.extend(private_npm_registry_1_server_futs);
futures.extend(private_npm_registry_2_server_futs);
+ futures.extend(private_npm_registry_3_server_futs);
assert_eq!(futures.len(), TEST_SERVERS_COUNT);
diff --git a/tests/util/server/src/servers/npm_registry.rs b/tests/util/server/src/servers/npm_registry.rs
index acbd9cab4..4ada468fa 100644
--- a/tests/util/server/src/servers/npm_registry.rs
+++ b/tests/util/server/src/servers/npm_registry.rs
@@ -56,6 +56,14 @@ pub fn private_npm_registry2(port: u16) -> Vec<LocalBoxFuture<'static, ()>> {
)
}
+pub fn private_npm_registry3(port: u16) -> Vec<LocalBoxFuture<'static, ()>> {
+ run_npm_server(
+ port,
+ "npm private registry server error",
+ private_npm_registry3_handler,
+ )
+}
+
fn run_npm_server<F, S>(
port: u16,
error_msg: &'static str,
@@ -141,6 +149,13 @@ async fn private_npm_registry2_handler(
handle_req_for_registry(req, &npm::PRIVATE_TEST_NPM_REGISTRY_2).await
}
+async fn private_npm_registry3_handler(
+ req: Request<hyper::body::Incoming>,
+) -> Result<Response<UnsyncBoxBody<Bytes, Infallible>>, anyhow::Error> {
+ // No auth for this registry
+ handle_req_for_registry(req, &npm::PRIVATE_TEST_NPM_REGISTRY_3).await
+}
+
async fn handle_req_for_registry(
req: Request<Incoming>,
test_npm_registry: &npm::TestNpmRegistry,