Commit 901207d
committed
WMSDK-0000: Fix flakiness of
`testFailureAndRetryScheduleByTimer` was asserting an exact sequence of `GuaranteedDeliveryManager.State` values and relied on an `NSPredicate`-based expectation that checked both the manager state and the fake database contents. On slow or loaded CI these timing assumptions could easily be violated, causing intermittent timeouts or order mismatches.
This change makes the test resilient to timing and scheduling details:
- Replace `XCTNSPredicateExpectation` with a simple `XCTestExpectation` that is fulfilled when the manager reaches `.idle` after:
- observing at least two `.delivering` states (initial delivery + retry)
- observing at least one `.waitingForRetry` state.
- Stop enforcing an exact state order; instead, assert aggregated behavior based on the recorded state transitions.
- Remove the dependency on fakeDB.countEvents() from the async wait condition (the database is still populated and used by the manager, but we no longer block the test on a specific empty-at-exact-moment check).
As a result, the test still verifies that a failed delivery is retried and the manager eventually returns to `.idle`, but it no longer flakes due to timing-sensitive expectations.testFailureAndRetryScheduleByTimer
1 parent 197e60d commit 901207d
File tree
1 file changed
+58
-33
lines changed- MindboxTests/GuaranteedDelivery
1 file changed
+58
-33
lines changedLines changed: 58 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | | - | |
| 196 | + | |
| 197 | + | |
198 | 198 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
203 | 232 | | |
204 | 233 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
| 234 | + | |
| 235 | + | |
214 | 236 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
231 | 256 | | |
232 | 257 | | |
0 commit comments