@@ -46,15 +46,15 @@ async def test_retry_overload_error_command(self):
46
46
await self .db .t .insert_one ({"x" : 1 })
47
47
48
48
# Ensure command is retried on overload error.
49
- fail_once = mock_overload_error .copy ()
50
- fail_once ["mode" ] = {"times" : _MAX_RETRIES }
51
- async with self .fail_point (fail_once ):
49
+ fail_many = mock_overload_error .copy ()
50
+ fail_many ["mode" ] = {"times" : _MAX_RETRIES }
51
+ async with self .fail_point (fail_many ):
52
52
await self .db .command ("find" , "t" )
53
53
54
54
# Ensure command stops retrying after _MAX_RETRIES.
55
- fail_many_times = mock_overload_error .copy ()
56
- fail_many_times ["mode" ] = {"times" : _MAX_RETRIES + 1 }
57
- async with self .fail_point (fail_many_times ):
55
+ fail_too_many = mock_overload_error .copy ()
56
+ fail_too_many ["mode" ] = {"times" : _MAX_RETRIES + 1 }
57
+ async with self .fail_point (fail_too_many ):
58
58
with self .assertRaises (PyMongoError ) as error :
59
59
await self .db .command ("find" , "t" )
60
60
@@ -65,15 +65,15 @@ async def test_retry_overload_error_find(self):
65
65
await self .db .t .insert_one ({"x" : 1 })
66
66
67
67
# Ensure command is retried on overload error.
68
- fail_once = mock_overload_error .copy ()
69
- fail_once ["mode" ] = {"times" : _MAX_RETRIES }
70
- async with self .fail_point (fail_once ):
68
+ fail_many = mock_overload_error .copy ()
69
+ fail_many ["mode" ] = {"times" : _MAX_RETRIES }
70
+ async with self .fail_point (fail_many ):
71
71
await self .db .t .find_one ()
72
72
73
73
# Ensure command stops retrying after _MAX_RETRIES.
74
- fail_many_times = mock_overload_error .copy ()
75
- fail_many_times ["mode" ] = {"times" : _MAX_RETRIES + 1 }
76
- async with self .fail_point (fail_many_times ):
74
+ fail_too_many = mock_overload_error .copy ()
75
+ fail_too_many ["mode" ] = {"times" : _MAX_RETRIES + 1 }
76
+ async with self .fail_point (fail_too_many ):
77
77
with self .assertRaises (PyMongoError ) as error :
78
78
await self .db .t .find_one ()
79
79
@@ -84,15 +84,15 @@ async def test_retry_overload_error_insert_one(self):
84
84
await self .db .t .insert_one ({"x" : 1 })
85
85
86
86
# Ensure command is retried on overload error.
87
- fail_once = mock_overload_error .copy ()
88
- fail_once ["mode" ] = {"times" : _MAX_RETRIES }
89
- async with self .fail_point (fail_once ):
87
+ fail_many = mock_overload_error .copy ()
88
+ fail_many ["mode" ] = {"times" : _MAX_RETRIES }
89
+ async with self .fail_point (fail_many ):
90
90
await self .db .t .find_one ()
91
91
92
92
# Ensure command stops retrying after _MAX_RETRIES.
93
- fail_many_times = mock_overload_error .copy ()
94
- fail_many_times ["mode" ] = {"times" : _MAX_RETRIES + 1 }
95
- async with self .fail_point (fail_many_times ):
93
+ fail_too_many = mock_overload_error .copy ()
94
+ fail_too_many ["mode" ] = {"times" : _MAX_RETRIES + 1 }
95
+ async with self .fail_point (fail_too_many ):
96
96
with self .assertRaises (PyMongoError ) as error :
97
97
await self .db .t .find_one ()
98
98
@@ -105,15 +105,15 @@ async def test_retry_overload_error_update_many(self):
105
105
await self .db .t .insert_one ({"x" : 1 })
106
106
107
107
# Ensure command is retried on overload error.
108
- fail_once = mock_overload_error .copy ()
109
- fail_once ["mode" ] = {"times" : _MAX_RETRIES }
110
- async with self .fail_point (fail_once ):
108
+ fail_many = mock_overload_error .copy ()
109
+ fail_many ["mode" ] = {"times" : _MAX_RETRIES }
110
+ async with self .fail_point (fail_many ):
111
111
await self .db .t .update_many ({}, {"$set" : {"x" : 2 }})
112
112
113
113
# Ensure command stops retrying after _MAX_RETRIES.
114
- fail_many_times = mock_overload_error .copy ()
115
- fail_many_times ["mode" ] = {"times" : _MAX_RETRIES + 1 }
116
- async with self .fail_point (fail_many_times ):
114
+ fail_too_many = mock_overload_error .copy ()
115
+ fail_too_many ["mode" ] = {"times" : _MAX_RETRIES + 1 }
116
+ async with self .fail_point (fail_too_many ):
117
117
with self .assertRaises (PyMongoError ) as error :
118
118
await self .db .t .update_many ({}, {"$set" : {"x" : 2 }})
119
119
@@ -125,7 +125,7 @@ async def test_retry_overload_error_getMore(self):
125
125
await coll .insert_many ([{"x" : 1 } for _ in range (10 )])
126
126
127
127
# Ensure command is retried on overload error.
128
- fail_once = {
128
+ fail_many = {
129
129
"configureFailPoint" : "failCommand" ,
130
130
"mode" : {"times" : _MAX_RETRIES },
131
131
"data" : {
@@ -136,15 +136,15 @@ async def test_retry_overload_error_getMore(self):
136
136
}
137
137
cursor = coll .find (batch_size = 2 )
138
138
await cursor .next ()
139
- async with self .fail_point (fail_once ):
139
+ async with self .fail_point (fail_many ):
140
140
await cursor .to_list ()
141
141
142
142
# Ensure command stops retrying after _MAX_RETRIES.
143
- fail_many_times = fail_once .copy ()
144
- fail_many_times ["mode" ] = {"times" : _MAX_RETRIES + 1 }
143
+ fail_too_many = fail_many .copy ()
144
+ fail_too_many ["mode" ] = {"times" : _MAX_RETRIES + 1 }
145
145
cursor = coll .find (batch_size = 2 )
146
146
await cursor .next ()
147
- async with self .fail_point (fail_many_times ):
147
+ async with self .fail_point (fail_too_many ):
148
148
with self .assertRaises (PyMongoError ) as error :
149
149
await cursor .to_list ()
150
150
0 commit comments