Skip to content

Commit

Permalink
Remove #[serial_test::serial] from almost all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Wadjetz committed Jan 3, 2024
1 parent 8c3d6c2 commit e91e5b7
Show file tree
Hide file tree
Showing 30 changed files with 2 additions and 154 deletions.
2 changes: 0 additions & 2 deletions editoast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ To avoid thread conflicts while accessing the database, use serial_test
#[serial_test::serial]
```

<!--- TODO: when tests are isolated, allow multiple threads (4 may be a good tradeoff for speed/DB pool) --->

```sh
cargo test
```
Expand Down
1 change: 0 additions & 1 deletion editoast/src/generated_data/error/switches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ mod tests {
}

#[test]
#[serial_test::serial]
fn not_unique_endpoints() {
let mut infra_cache = create_small_infra_cache();
// Ports A and B1 map the same endpoint
Expand Down
3 changes: 0 additions & 3 deletions editoast/src/generated_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ pub mod tests {
use diesel_async::AsyncPgConnection as PgConnection;

#[actix_test] // Slow test
#[serial_test::serial]
async fn refresh_all_test() {
test_infra_and_delete(|pool, infra: Infra| {
async move {
Expand All @@ -170,7 +169,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn update_all_test() {
test_infra_transaction(|conn: &mut PgConnection, infra: Infra| {
async move {
Expand All @@ -186,7 +184,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn clear_all_test() {
test_infra_transaction(|conn: &mut PgConnection, infra: Infra| {
async move {
Expand Down
12 changes: 0 additions & 12 deletions editoast/src/infra_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,6 @@ pub mod tests {
};

#[actix_test]
#[serial_test::serial]
async fn load_track_section() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -741,7 +740,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_signal() {
test_infra_transaction(|conn, infra| {
{
Expand All @@ -759,7 +757,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_speed_section() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -783,7 +780,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_route() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -797,7 +793,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_operational_point() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -823,7 +818,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_switch() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -845,7 +839,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_switch_type() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -859,7 +852,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_detector() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -877,7 +869,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_buffer_stop() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -895,7 +886,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_catenary() {
test_infra_transaction(|conn, infra| {
async move {
Expand Down Expand Up @@ -1199,7 +1189,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_infra_cache() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -1219,7 +1208,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn load_infra_cache_mut() {
test_infra_transaction(|conn, infra| {
async move {
Expand Down
9 changes: 0 additions & 9 deletions editoast/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ mod tests {
use tempfile::NamedTempFile;

#[rstest]
#[serial_test::serial]
async fn import_rolling_stock_ko_file_not_found(db_pool: Data<DbPool>) {
// GIVEN
let args = ImportRollingStockArgs {
Expand All @@ -768,7 +767,6 @@ mod tests {
}

#[rstest]
#[serial_test::serial]
async fn import_non_electric_rs_without_startup_and_panto_values(db_pool: Data<DbPool>) {
// GIVEN
let rolling_stock_name =
Expand Down Expand Up @@ -800,7 +798,6 @@ mod tests {
}

#[rstest]
#[serial_test::serial]
async fn import_non_electric_rs_with_startup_and_panto_values(db_pool: Data<DbPool>) {
// GIVEN
let rolling_stock_name =
Expand Down Expand Up @@ -836,7 +833,6 @@ mod tests {
}

#[rstest]
#[serial_test::serial]
async fn import_electric_rs_without_startup_and_panto_values(db_pool: Data<DbPool>) {
// GIVEN
let rolling_stock_name =
Expand Down Expand Up @@ -864,7 +860,6 @@ mod tests {
}

#[rstest]
#[serial_test::serial]
async fn import_electric_rs_with_startup_and_panto_values(db_pool: Data<DbPool>) {
// GIVEN
let rolling_stock_name =
Expand Down Expand Up @@ -904,7 +899,6 @@ mod tests {
}

#[rstest]
#[serial_test::serial]
async fn import_railjson_ko_file_not_found(db_pool: Data<DbPool>) {
// GIVEN
let railjson_path = "non/existing/railjson/file/location";
Expand All @@ -930,7 +924,6 @@ mod tests {
}

#[rstest]
#[serial_test::serial]
async fn import_railjson_ok(db_pool: Data<DbPool>) {
// GIVEN
let railjson = Default::default();
Expand Down Expand Up @@ -970,7 +963,6 @@ mod tests {
}

#[rstest]
#[serial_test::serial]
async fn test_electrical_profile_set_delete(
#[future] electrical_profile_set: TestFixture<ElectricalProfileSet>,
db_pool: Data<DbPool>,
Expand Down Expand Up @@ -998,7 +990,6 @@ mod tests {
}

#[rstest]
#[serial_test::serial]
async fn test_electrical_profile_set_list_doesnt_fail(
#[future] electrical_profile_set: TestFixture<ElectricalProfileSet>,
db_pool: Data<DbPool>,
Expand Down
4 changes: 0 additions & 4 deletions editoast/src/models/infra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn create_infra() {
test_infra_transaction(|_, infra| {
async move {
Expand All @@ -387,7 +386,6 @@ pub mod tests {
}

#[rstest]
#[serial_test::serial]
async fn clone_infra_with_new_name_returns_new_cloned_infra() {
// GIVEN
let pg_db_pool = db_pool();
Expand Down Expand Up @@ -420,7 +418,6 @@ pub mod tests {
}

#[rstest]
#[serial_test::serial]
async fn clone_infra_without_new_name_returns_new_cloned_infra() {
// GIVEN
let pg_db_pool = db_pool();
Expand Down Expand Up @@ -449,7 +446,6 @@ pub mod tests {
}

#[actix_test]
#[serial_test::serial]
async fn clone_infra_returns_infra_not_found() {
// GIVEN
let not_found_infra_id: i64 = 1234567890;
Expand Down
4 changes: 0 additions & 4 deletions editoast/src/models/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ pub mod test {
use rstest::rstest;

#[rstest]
#[serial_test::serial]
async fn create_delete_project(#[future] project: TestFixture<Project>, db_pool: Data<DbPool>) {
let project = project.await;
// Delete the project
Expand All @@ -290,7 +289,6 @@ pub mod test {
}

#[rstest]
#[serial_test::serial]
async fn get_project(#[future] project: TestFixture<Project>, db_pool: Data<DbPool>) {
let project = project.await;

Expand All @@ -307,7 +305,6 @@ pub mod test {
}

#[rstest]
#[serial_test::serial]
async fn sort_project(#[future] project: TestFixture<Project>, db_pool: Data<DbPool>) {
let project = project.await;

Expand All @@ -332,7 +329,6 @@ pub mod test {
}

#[rstest]
#[serial_test::serial]
async fn update_project(#[future] project: TestFixture<Project>, db_pool: Data<DbPool>) {
let project_fixture = project.await;

Expand Down
2 changes: 0 additions & 2 deletions editoast/src/models/rolling_stock/light_rolling_stock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ pub mod tests {
use super::LightRollingStockModel;

#[rstest]
#[serial_test::serial]
async fn get_light_rolling_stock(db_pool: Data<DbPool>) {
// GIVEN
let rolling_stock = named_fast_rolling_stock(
Expand All @@ -150,7 +149,6 @@ pub mod tests {
}

#[rstest]
#[serial_test::serial]
async fn list_light_rolling_stock(db_pool: Data<DbPool>) {
// GIVEN
let rolling_stock = named_fast_rolling_stock(
Expand Down
3 changes: 0 additions & 3 deletions editoast/src/models/rolling_stock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ pub mod tests {
}

#[rstest]
#[serial_test::serial]
async fn create_delete_rolling_stock(db_pool: Data<DbPool>) {
let name = "fast_rolling_stock_create_delete_rolling_stock";
let rolling_stock_id: i64;
Expand All @@ -348,7 +347,6 @@ pub mod tests {
}

#[rstest]
#[serial_test::serial]
async fn update_rolling_stock(db_pool: Data<DbPool>) {
// GIVEN
let other_rs_name = "other_rolling_stock_update_rolling_stock";
Expand All @@ -372,7 +370,6 @@ pub mod tests {
}

#[rstest]
#[serial_test::serial]
async fn update_rolling_stock_failure_name_already_used(db_pool: Data<DbPool>) {
// GIVEN
let name = "fast_rolling_stock_update_rolling_stock_failure_name_already_used";
Expand Down
3 changes: 0 additions & 3 deletions editoast/src/models/scenario.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ pub mod test {
use rstest::rstest;

#[rstest]
#[serial_test::serial]
async fn create_delete_scenario(db_pool: Data<DbPool>) {
let ScenarioFixtureSet { scenario, .. } = scenario_fixture_set().await;

Expand All @@ -236,7 +235,6 @@ pub mod test {
}

#[rstest]
#[serial_test::serial]
async fn get_study(db_pool: Data<DbPool>) {
let ScenarioFixtureSet { study, .. } = scenario_fixture_set().await;

Expand All @@ -255,7 +253,6 @@ pub mod test {
}

#[rstest]
#[serial_test::serial]
async fn sort_scenario(db_pool: Data<DbPool>) {
let ScenarioFixtureSet {
scenario,
Expand Down
3 changes: 0 additions & 3 deletions editoast/src/models/study.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ pub mod test {
use rstest::rstest;

#[rstest]
#[serial_test::serial]
async fn create_delete_study(
#[future] study_fixture_set: StudyFixtureSet,
db_pool: Data<DbPool>,
Expand All @@ -214,7 +213,6 @@ pub mod test {
}

#[rstest]
#[serial_test::serial]
async fn get_study(#[future] study_fixture_set: StudyFixtureSet, db_pool: Data<DbPool>) {
let StudyFixtureSet { study, project } = study_fixture_set.await;

Expand All @@ -231,7 +229,6 @@ pub mod test {
}

#[rstest]
#[serial_test::serial]
async fn sort_study(#[future] study_fixture_set: StudyFixtureSet, db_pool: Data<DbPool>) {
let StudyFixtureSet { study, project } = study_fixture_set.await;

Expand Down
2 changes: 0 additions & 2 deletions editoast/src/schema/buffer_stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ mod test {
use diesel_async::scoped_futures::ScopedFutureExt;

#[actix_test]
#[serial_test::serial]
async fn test_persist() {
test_infra_transaction(|conn, infra| {
async move {
Expand All @@ -122,7 +121,6 @@ mod test {
}

#[actix_test] // Slow test
#[serial_test::serial]
async fn test_persist_large() {
test_infra_transaction(|conn, infra| {
async move {
Expand Down
Loading

0 comments on commit e91e5b7

Please sign in to comment.