Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
//! Under `--json` both diagnostics stay off stderr — the envelope is the
//! machine channel, and `apply_invariants.rs` pins its exact shape for
//! this path (partialFailure, empty events, NO top-level error record —
//! deliberately distinct from vendor's `no_local_source` hard error).
//! unlike vendor, which records a `failed` / `apply_failed` event for the
//! patch; see `vendor/vendor_silent_errors.rs`).

use std::path::Path;

Expand Down
197 changes: 0 additions & 197 deletions crates/socket-patch-cli/tests/coverage_fix_vendor_silent_mute_exit.rs

This file was deleted.

3 changes: 2 additions & 1 deletion crates/socket-patch-cli/tests/vendor/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! `vendor`: lockfile-only gems, pristine fetch order, no-network re-runs, bun, the hosted redirects, the failure paths and the human render.
//! `vendor`: lockfile-only gems, pristine fetch order, no-network re-runs, bun, the hosted redirects, the failure paths, the `--silent` error output and the human render.
//!
//! One test binary per command: each module was its own binary.

Expand All @@ -21,6 +21,7 @@ mod vendor_failure_paths;
mod vendor_gem_lockfile_only_e2e;
mod vendor_render;
mod vendor_rerun_no_network_e2e;
mod vendor_silent_errors;

#[path = "../prebuilt_common/mod.rs"]
mod prebuilt_common;
Expand Down
15 changes: 13 additions & 2 deletions crates/socket-patch-cli/tests/vendor/npm_fixture.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! The offline npm fixture and runners `vendor_failure_paths.rs` and
//! `vendor_render.rs` share: a self-contained npm project with a staged
//! The offline npm fixture and runners `vendor_failure_paths.rs`,
//! `vendor_render.rs` and `vendor_silent_errors.rs` share: a self-contained npm project with a staged
//! patch blob, driven either in-process (`vendor_run`) or through the built
//! binary with a scrubbed child environment (`run_cli` / `vendor_cli`). No
//! test mutates this process's environment.
Expand Down Expand Up @@ -222,6 +222,17 @@ pub(crate) fn vendor_cli(cwd: &Path, extra: &[&str]) -> (i32, Value) {
(code, env)
}

/// A guaranteed-unreachable local endpoint: bind an ephemeral port, then
/// release it, so every request fails fast with connection-refused.
pub(crate) fn dead_endpoint() -> String {
let port = std::net::TcpListener::bind("127.0.0.1:0")
.unwrap()
.local_addr()
.unwrap()
.port();
format!("http://127.0.0.1:{port}")
}

/// A synthetic ledger with one entry of `eco` for [`PURL`], written via the
/// real `save_state` serializer (what a tampered-but-parseable state.json
/// deserializes into).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Service vendoring of portable gems without a local install or registry fetch.

use crate::common::{binary, git_sha256, hermetic};
use crate::npm_fixture::dead_endpoint;

use std::path::Path;

Expand Down Expand Up @@ -161,17 +162,6 @@ fn run_vendor(root: &Path, source: &str, api_url: &str) -> (i32, serde_json::Val
(out.status.code().unwrap_or(-1), v, stderr)
}

/// A guaranteed-unreachable local endpoint: bind an ephemeral port, then
/// release it, so every request fails fast with connection-refused.
fn dead_endpoint() -> String {
let port = std::net::TcpListener::bind("127.0.0.1:0")
.unwrap()
.local_addr()
.unwrap()
.port();
format!("http://127.0.0.1:{port}")
}

fn failed_event(v: &serde_json::Value) -> &serde_json::Value {
v["events"]
.as_array()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,12 @@
//! guaranteed-dead local endpoint, and patch staging reads `.socket/blobs`.

use crate::common::{binary, git_sha256, hermetic};
use crate::npm_fixture::dead_endpoint;

use std::path::Path;

use sha2::{Digest, Sha256};

/// A guaranteed-unreachable local endpoint: bind an ephemeral port, then
/// release it, so every request fails fast with connection-refused.
fn dead_endpoint() -> String {
let port = std::net::TcpListener::bind("127.0.0.1:0")
.unwrap()
.local_addr()
.unwrap()
.port();
format!("http://127.0.0.1:{port}")
}

/// `.socket/manifest.json` with one patch and its after-blob.
fn write_manifest(root: &Path, purl: &str, uuid: &str, file: &str, before: &[u8], after: &[u8]) {
let socket = root.join(".socket");
Expand Down
Loading
Loading