Skip to content

Commit d99f1ea

Browse files
committed
tests/krate/publish: Fix new_krate_tarball_with_hard_links()
The test was receiving "too large when decompressed" because of a broken header checksum, which was mistakenly converted into this error message, because we assume that every `entries()` error is coming from our `LimitErrorReader`. This commit moves the checksum calculation to the right place, which causes the test to now test the correct condition in our `verify_tarball()` function.
1 parent 2d81921 commit d99f1ea

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/tests/krate/publish.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,9 +876,9 @@ fn new_krate_tarball_with_hard_links() {
876876
let mut header = tar::Header::new_gnu();
877877
assert_ok!(header.set_path("foo-1.1.0/bar"));
878878
header.set_size(0);
879-
header.set_cksum();
880879
header.set_entry_type(tar::EntryType::hard_link());
881880
assert_ok!(header.set_link_name("foo-1.1.0/another"));
881+
header.set_cksum();
882882
assert_ok!(ar.append(&header, &[][..]));
883883
assert_ok!(ar.finish());
884884
}
@@ -890,9 +890,7 @@ fn new_krate_tarball_with_hard_links() {
890890
.bad_with_status(StatusCode::OK);
891891

892892
assert!(
893-
json.errors[0]
894-
.detail
895-
.contains("too large when decompressed"),
893+
json.errors[0].detail.contains("invalid tarball uploaded"),
896894
"{:?}",
897895
json.errors
898896
);

0 commit comments

Comments
 (0)