Commit ef3ef96 1 parent b3bd952 commit ef3ef96 Copy full SHA for ef3ef96
File tree 9 files changed +20
-17
lines changed
9 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,14 @@ impl DbConnectionPoolV2 {
134
134
/// # }
135
135
/// ```
136
136
///
137
+ /// ### Deadlocks
138
+ ///
139
+ /// We encountered a deadlock error in our tests,
140
+ /// especially those using `empty_infra` and `small_infra`.
141
+ /// Adding `#[serial_test::serial]` solved the issue.
142
+ /// We tried increasing the deadlock timeout, but that didn't work.
143
+ /// Using random `infra_id` with rand didn't help either.
144
+ ///
137
145
/// ## Guidelines
138
146
///
139
147
/// To prevent these issues, prefer the following patterns:
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ use crate::error::Result;
40
40
use crate :: infra_cache:: operation:: CacheOperation ;
41
41
use crate :: infra_cache:: InfraCache ;
42
42
use editoast_models:: DbConnection ;
43
- use editoast_models:: DbConnectionPool ;
44
43
use editoast_models:: DbConnectionPoolV2 ;
45
44
46
45
editoast_common:: schemas! {
@@ -173,7 +172,9 @@ pub mod tests {
173
172
use crate :: modelsv2:: fixtures:: create_empty_infra;
174
173
use editoast_models:: DbConnectionPoolV2 ;
175
174
176
- #[ rstest] // Slow test
175
+ #[ rstest]
176
+ // Slow test
177
+ // PostgreSQL deadlock can happen in this test, see section `Deadlock` of [DbConnectionPoolV2::get] for more information
177
178
#[ serial_test:: serial]
178
179
async fn refresh_all_test ( ) {
179
180
let db_pool = DbConnectionPoolV2 :: for_tests ( ) ;
Original file line number Diff line number Diff line change @@ -37,11 +37,8 @@ use crate::modelsv2::get_table;
37
37
use crate :: modelsv2:: prelude:: * ;
38
38
use crate :: modelsv2:: railjson:: persist_railjson;
39
39
use crate :: modelsv2:: Create ;
40
- use crate :: modelsv2:: DbConnection ;
41
- use crate :: modelsv2:: DbConnectionPoolV2 ;
42
40
use crate :: tables:: infra:: dsl;
43
41
use editoast_models:: DbConnection ;
44
- use editoast_models:: DbConnectionPool ;
45
42
use editoast_models:: DbConnectionPoolV2 ;
46
43
use editoast_schemas:: infra:: RailJson ;
47
44
use editoast_schemas:: infra:: RAILJSON_VERSION ;
@@ -337,6 +334,7 @@ pub mod tests {
337
334
}
338
335
339
336
#[ rstest]
337
+ // PostgreSQL deadlock can happen in this test, see section `Deadlock` of [DbConnectionPoolV2::get] for more information
340
338
#[ serial_test:: serial]
341
339
async fn clone_infra_with_new_name_returns_new_cloned_infra ( ) {
342
340
// GIVEN
Original file line number Diff line number Diff line change @@ -5,10 +5,8 @@ use editoast_schemas::infra::RAILJSON_VERSION;
5
5
use crate :: error:: Result ;
6
6
use crate :: modelsv2:: infra_objects:: * ;
7
7
use crate :: modelsv2:: prelude:: * ;
8
- use editoast_models:: DbConnection ;
9
- use editoast_models:: DbConnectionPool ;
10
- use editoast_models:: DbConnectionPoolV2 ;
11
8
use diesel_async:: AsyncConnection ;
9
+ use editoast_models:: DbConnection ;
12
10
13
11
#[ derive( Debug , thiserror:: Error , EditoastError ) ]
14
12
#[ editoast_error( base_id = "railjson" ) ]
Original file line number Diff line number Diff line change @@ -28,8 +28,6 @@ use crate::modelsv2::prelude::*;
28
28
use crate :: modelsv2:: Infra ;
29
29
use crate :: views:: infra:: InfraApiError ;
30
30
use crate :: views:: infra:: InfraIdParam ;
31
- use editoast_models:: DbConnection ;
32
- use editoast_models:: DbConnectionPool ;
33
31
use editoast_models:: DbConnectionPoolV2 ;
34
32
use editoast_schemas:: infra:: InfraObject ;
35
33
use editoast_schemas:: primitives:: OSRDIdentified as _;
Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ use crate::views::infra::InfraApiError;
43
43
use crate :: views:: infra:: InfraIdParam ;
44
44
use crate :: RedisClient ;
45
45
use editoast_models:: DbConnection ;
46
- use editoast_models:: DbConnectionPool ;
47
46
use editoast_models:: DbConnectionPoolV2 ;
48
47
use editoast_schemas:: infra:: InfraObject ;
49
48
@@ -158,7 +157,7 @@ pub async fn split_track_section<'a>(
158
157
159
158
// Calling the DB to get the full object and also the split geo
160
159
let result = infra
161
- . get_splited_track_section_with_data (
160
+ . get_split_track_section_with_data (
162
161
db_pool. get ( ) . await ?. deref_mut ( ) ,
163
162
payload. track . clone ( ) ,
164
163
distance_fraction,
Original file line number Diff line number Diff line change @@ -46,7 +46,6 @@ use crate::modelsv2::Infra;
46
46
use crate :: views:: pagination:: PaginatedList as _;
47
47
use crate :: views:: pagination:: PaginationQueryParam ;
48
48
use crate :: RedisClient ;
49
- use editoast_models:: DbConnectionPool ;
50
49
use editoast_models:: DbConnectionPoolV2 ;
51
50
use editoast_schemas:: infra:: SwitchType ;
52
51
@@ -885,7 +884,10 @@ pub mod tests {
885
884
assert_eq ! ( refreshed_infras. infra_refreshed, vec![ empty_infra. id] ) ;
886
885
}
887
886
888
- #[ rstest] // Slow test
887
+ #[ rstest]
888
+ // Slow test
889
+ // PostgreSQL deadlock can happen in this test, see section `Deadlock` of [DbConnectionPoolV2::get] for more information
890
+ #[ serial_test:: serial]
889
891
async fn infra_refresh_force ( ) {
890
892
let app = TestAppBuilder :: default_app ( ) ;
891
893
let db_pool = app. db_pool ( ) ;
Original file line number Diff line number Diff line change @@ -27,8 +27,6 @@ use crate::modelsv2::prelude::*;
27
27
use crate :: modelsv2:: Infra ;
28
28
use crate :: views:: infra:: InfraApiError ;
29
29
use crate :: views:: infra:: InfraIdParam ;
30
- use editoast_models:: DbConnection ;
31
- use editoast_models:: DbConnectionPool ;
32
30
use editoast_models:: DbConnectionPoolV2 ;
33
31
use editoast_schemas:: primitives:: ObjectType ;
34
32
@@ -198,6 +196,7 @@ mod tests {
198
196
use editoast_schemas:: infra:: SwitchType ;
199
197
200
198
#[ rstest]
199
+ // PostgreSQL deadlock can happen in this test, see section `Deadlock` of [DbConnectionPoolV2::get] for more information
201
200
#[ serial_test:: serial]
202
201
async fn test_get_railjson ( ) {
203
202
let app = TestAppBuilder :: default_app ( ) ;
@@ -223,6 +222,7 @@ mod tests {
223
222
}
224
223
225
224
#[ rstest]
225
+ // PostgreSQL deadlock can happen in this test, see section `Deadlock` of [DbConnectionPoolV2::get] for more information
226
226
#[ serial_test:: serial]
227
227
async fn test_post_railjson ( ) {
228
228
let app = TestAppBuilder :: default_app ( ) ;
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ use crate::modelsv2::Infra;
22
22
use crate :: views:: infra:: InfraApiError ;
23
23
use crate :: views:: infra:: InfraIdParam ;
24
24
use crate :: views:: params:: List ;
25
- use editoast_models:: DbConnectionPool ;
26
25
use editoast_models:: DbConnectionPoolV2 ;
27
26
28
27
crate :: routes! {
You can’t perform that action at this time.
0 commit comments