Skip to content

Commit c6de914

Browse files
committed
Use a different crate name in a test to prevent deadlocks
This test does a lot of different manipulations of categories and crate categories and it was using a crate named foo. The good_categories test also used a crate named foo, and these two tests were causing a postgres deadlock. I was able to cause deadlocks more often by duplicating the update_crate test and the good_categories test: https://travis-ci.org/integer32llc/crates.io/builds/187302718 Making this change and running the duplicated tests resulted in 0 deadlocks: https://travis-ci.org/integer32llc/crates.io/builds/187306433 This is unlikely to happen in production; requests get a database connection that gets closed when the request finishes, and the publish request only modifies the categories once, not as much as the update_crate test is. It seems unlikely that two people would publish the same crate at exactly the same time.
1 parent c2d5cf8 commit c6de914

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tests/category.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn update_crate() {
7474
::json::<GoodCategory>(&mut response).category.crates_cnt as usize
7575
};
7676
::mock_user(&mut req, ::user("foo"));
77-
let (krate, _) = ::mock_crate(&mut req, ::krate("foo"));
77+
let (krate, _) = ::mock_crate(&mut req, ::krate("foocat"));
7878
::mock_category(&mut req, "cat1", "cat1");
7979
::mock_category(&mut req, "Category 2", "category-2");
8080

0 commit comments

Comments
 (0)