Skip to content

Commit 06139b9

Browse files
Revert "removed shutdown testcase (maybe, calling System.exit)"
This reverts commit e14b071.
1 parent e14b071 commit 06139b9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

plugins/maintenance/src/test/java/org/apache/cloudstack/maintenance/ManagementServerMaintenanceManagerImplTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,19 @@ public void triggerShutdownCmdMsInUpStateAndOtherMsHostsInPreparingState() {
288288
});
289289
}
290290

291+
@Test
292+
public void triggerShutdownCmd() {
293+
ManagementServerHostVO msHost = mock(ManagementServerHostVO.class);
294+
Mockito.when(msHost.getState()).thenReturn(ManagementServerHost.State.ReadyToShutDown);
295+
Mockito.when(msHostDao.findById(1L)).thenReturn(msHost);
296+
TriggerShutdownCmd cmd = mock(TriggerShutdownCmd.class);
297+
Mockito.when(cmd.getManagementServerId()).thenReturn(1L);
298+
Mockito.when(clusterManagerMock.execute(anyString(), anyLong(), anyString(), anyBoolean())).thenReturn("Success");
299+
300+
spy.triggerShutdown(cmd);
301+
Mockito.verify(clusterManagerMock, Mockito.times(1)).execute(anyString(), anyLong(), anyString(), anyBoolean());
302+
}
303+
291304
@Test
292305
public void prepareForMaintenanceAndCancelFromMaintenanceState() {
293306
Mockito.doNothing().when(jobManagerMock).disableAsyncJobs();

0 commit comments

Comments
 (0)