Skip to content
Open
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
32 changes: 31 additions & 1 deletion crates/socket-patch-cli/tests/e2e_bun_lockb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,24 @@ fn rollback_refuses_binary_hosted_pin_then_checkout(
) {
let hosted_lock = fixture.lock();
let uri = server.uri();
// `--api-url`: the agent leg downloads before-blobs through the patch
// API, which `--patch-server-url` does not redirect; without it the
// run reached the live public proxy and the outcome depended on
// whether that served minimist's original `index.js` blob.
let (code, env) = cli_code(
&fixture.project,
&["rollback", "--yes", "--patch-server-url", &uri],
&[
"rollback",
"--yes",
"--api-url",
&uri,
"--api-token",
"fake",
"--org",
ORG,
"--patch-server-url",
&uri,
],
);
assert_eq!(code, 1, "a binary hosted pin cannot be restored: {env}");
// The refused pin counts as a failure (#1066). After a takeover a
Expand Down Expand Up @@ -874,6 +889,21 @@ async fn mock_api_patch(server: &MockServer, fixture: &Fixture, uuid: &str, patc
)
.mount(server)
.await;
// The original `index.js` blob. `rollback`'s missing-blob gate
// downloads it when an installed copy matches neither patch hash (the
// `bundled` shape's untouched nested minimist); see
// `rollback_refuses_binary_hosted_pin_then_checkout`.
Mock::given(method("GET"))
.and(path(format!(
"/v0/orgs/{ORG}/patches/blob/{}",
compute_git_sha256_from_bytes(&fixture.original)
)))
.respond_with(
ResponseTemplate::new(200)
.set_body_raw(fixture.original.clone(), "application/octet-stream"),
)
.mount(server)
.await;
Mock::given(method("GET"))
.and(path_regex(format!("^/patch/npm/{name}/.*$")))
.respond_with(ResponseTemplate::new(200).set_body_raw(tgz, "application/octet-stream"))
Expand Down
Loading