Skip to content

Commit

Permalink
LPD-29780 Check the NOT_APPLICABLE cluster mode is not scheduled/unsc…
Browse files Browse the repository at this point in the history
…heduled in any case
  • Loading branch information
ccorreagg authored and brianchandotcom committed Jul 8, 2024
1 parent 73200cc commit 52eedc7
Showing 1 changed file with 54 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void setUp() {
_dispatchTriggerLocalService.getDispatchTriggers(true)
).thenReturn(
ListUtil.fromArray(
_allNodesDispatchTrigger,
_allNodesDispatchTrigger, _notApplicableDispatchTrigger,
_singleNodeMemoryClusteredDispatchTrigger,
_singleNodePersistedDispatchTrigger)
);
Expand All @@ -67,6 +67,12 @@ public void setUp() {
DispatchTaskClusterMode.ALL_NODES.getMode()
);

Mockito.when(
_notApplicableDispatchTrigger.getDispatchTaskClusterMode()
).thenReturn(
DispatchTaskClusterMode.NOT_APPLICABLE.getMode()
);

Mockito.when(
_singleNodeMemoryClusteredDispatchTrigger.
getDispatchTaskClusterMode()
Expand Down Expand Up @@ -103,6 +109,10 @@ public void testOnActivationSchedulesAllTypesOfJobsOnMasterNode()
_allNodesDispatchTrigger
).getDispatchTaskClusterMode();

Mockito.verify(
_notApplicableDispatchTrigger
).getDispatchTaskClusterMode();

Mockito.verify(
_singleNodeMemoryClusteredDispatchTrigger
).getDispatchTaskClusterMode();
Expand All @@ -118,6 +128,13 @@ public void testOnActivationSchedulesAllTypesOfJobsOnMasterNode()
Mockito.eq(StorageType.MEMORY), Mockito.any()
);

Mockito.verify(
_dispatchTriggerHelper, Mockito.never()
).addSchedulerJob(
Mockito.same(_notApplicableDispatchTrigger),
Mockito.eq(StorageType.MEMORY), Mockito.any()
);

Mockito.verify(
_dispatchTriggerHelper
).addSchedulerJob(
Expand Down Expand Up @@ -153,6 +170,10 @@ public void testOnActivationSchedulesOnlyAllNodesJobs() throws Exception {
_allNodesDispatchTrigger
).getDispatchTaskClusterMode();

Mockito.verify(
_notApplicableDispatchTrigger
).getDispatchTaskClusterMode();

Mockito.verify(
_singleNodeMemoryClusteredDispatchTrigger
).getDispatchTaskClusterMode();
Expand All @@ -168,6 +189,13 @@ public void testOnActivationSchedulesOnlyAllNodesJobs() throws Exception {
Mockito.eq(StorageType.MEMORY), Mockito.any()
);

Mockito.verify(
_dispatchTriggerHelper, Mockito.never()
).addSchedulerJob(
Mockito.same(_notApplicableDispatchTrigger),
Mockito.eq(StorageType.MEMORY), Mockito.any()
);

Mockito.verify(
_dispatchTriggerHelper, Mockito.never()
).addSchedulerJob(
Expand Down Expand Up @@ -209,6 +237,10 @@ public void testOnDeactivationUnschedulesAllTypeOfJobsOnMasterNode() {
_allNodesDispatchTrigger
).getDispatchTaskClusterMode();

Mockito.verify(
_notApplicableDispatchTrigger
).getDispatchTaskClusterMode();

Mockito.verify(
_singleNodeMemoryClusteredDispatchTrigger
).getDispatchTaskClusterMode();
Expand All @@ -224,6 +256,13 @@ public void testOnDeactivationUnschedulesAllTypeOfJobsOnMasterNode() {
Mockito.eq(StorageType.MEMORY)
);

Mockito.verify(
_dispatchTriggerHelper, Mockito.never()
).deleteSchedulerJob(
Mockito.same(_notApplicableDispatchTrigger),
Mockito.eq(StorageType.MEMORY)
);

Mockito.verify(
_dispatchTriggerHelper
).deleteSchedulerJob(
Expand Down Expand Up @@ -265,6 +304,10 @@ public void testOnDeactivationUnschedulesOnlyAllNodesJobs() {
_allNodesDispatchTrigger
).getDispatchTaskClusterMode();

Mockito.verify(
_notApplicableDispatchTrigger
).getDispatchTaskClusterMode();

Mockito.verify(
_singleNodeMemoryClusteredDispatchTrigger
).getDispatchTaskClusterMode();
Expand All @@ -280,6 +323,13 @@ public void testOnDeactivationUnschedulesOnlyAllNodesJobs() {
Mockito.eq(StorageType.MEMORY)
);

Mockito.verify(
_dispatchTriggerHelper, Mockito.never()
).deleteSchedulerJob(
Mockito.same(_notApplicableDispatchTrigger),
Mockito.eq(StorageType.MEMORY)
);

Mockito.verify(
_dispatchTriggerHelper, Mockito.never()
).deleteSchedulerJob(
Expand Down Expand Up @@ -317,6 +367,9 @@ public void testOnDeactivationUnschedulesOnlyAllNodesJobs() {
@Mock
private DispatchTriggerLocalService _dispatchTriggerLocalService;

@Mock
private DispatchTrigger _notApplicableDispatchTrigger;

@Mock
private DispatchTrigger _singleNodeMemoryClusteredDispatchTrigger;

Expand Down

0 comments on commit 52eedc7

Please sign in to comment.