|
17 | 17 | package com.cloud.storage.snapshot; |
18 | 18 |
|
19 | 19 | import com.cloud.event.ActionEventUtils; |
| 20 | +import com.cloud.event.EventTypes; |
20 | 21 | import com.cloud.event.EventVO; |
21 | 22 | import com.cloud.event.dao.EventDao; |
22 | 23 | import com.cloud.storage.Snapshot; |
@@ -390,9 +391,11 @@ public void handleFailedSnapshotDispatchTestAtMaxGivesUpAndNotifies() { |
390 | 391 | snapshotSchedulerImplSpy.handleFailedSnapshotDispatch(snapshotScheduleVoMock, volumeVoMock, snapshotScheduleVoMock, null, new Exception("boom")); |
391 | 392 |
|
392 | 393 | actionEventUtilsMocked.verify(() -> ActionEventUtils.onCreatedActionEvent( |
393 | | - Mockito.anyLong(), Mockito.anyLong(), Mockito.eq(EventVO.LEVEL_ERROR), Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyString())); |
| 394 | + Mockito.anyLong(), Mockito.anyLong(), Mockito.eq(EventVO.LEVEL_ERROR), Mockito.eq(EventTypes.EVENT_SNAPSHOT_CREATE), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyString())); |
| 395 | + // Must use a distinct event type from EVENT_SNAPSHOT_CREATE, otherwise it becomes the "latest event" scanned |
| 396 | + // by countConsecutiveFailedAttempts and silently resets the consecutive-failure count on the next attempt. |
394 | 397 | actionEventUtilsMocked.verify(() -> ActionEventUtils.onCreatedActionEvent( |
395 | | - Mockito.anyLong(), Mockito.anyLong(), Mockito.eq(EventVO.LEVEL_WARN), Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyString())); |
| 398 | + Mockito.anyLong(), Mockito.anyLong(), Mockito.eq(EventVO.LEVEL_WARN), Mockito.eq(EventTypes.EVENT_SNAPSHOT_RECURRING_FAILURE_LIMIT_REACHED), Mockito.anyBoolean(), Mockito.anyString(), Mockito.anyLong(), Mockito.anyString())); |
396 | 399 | } |
397 | 400 |
|
398 | 401 | Mockito.verify(snapshotScheduleDaoMock).update(Mockito.anyLong(), Mockito.eq(snapshotScheduleVoMock)); |
|
0 commit comments