Skip to content

Commit d867216

Browse files
committed
Fix test failures
1 parent 0345d20 commit d867216

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

plugins/storage/volume/default/src/test/java/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImplTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import static org.mockito.Mockito.when;
2727

2828
import java.util.Arrays;
29+
import java.util.List;
2930

3031
import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
3132
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
@@ -153,6 +154,7 @@ public void initMocks() throws StorageConflictException {
153154
.thenReturn(Arrays.asList(host1, host2));
154155

155156
when(hostDao.findById(anyLong())).thenReturn(mock(HostVO.class));
157+
when(hostDao.listByIds(List.of(1L, 2L))).thenReturn(List.of(host1, host2));
156158
when(agentMgr.easySend(anyLong(), Mockito.any(ModifyStoragePoolCommand.class))).thenReturn(answer);
157159
when(answer.getResult()).thenReturn(true);
158160

plugins/storage/volume/scaleio/src/test/java/org/apache/cloudstack/storage/datastore/lifecycle/ScaleIOPrimaryDataStoreLifeCycleTest.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import static org.mockito.ArgumentMatchers.any;
2424
import static org.mockito.ArgumentMatchers.anyLong;
2525
import static org.mockito.ArgumentMatchers.anyMap;
26-
import static org.mockito.ArgumentMatchers.eq;
2726
import static org.mockito.Mockito.lenient;
2827
import static org.mockito.Mockito.mock;
2928
import static org.mockito.Mockito.mockStatic;
@@ -65,7 +64,6 @@
6564
import com.cloud.dc.dao.DataCenterDao;
6665
import com.cloud.host.dao.HostDao;
6766
import com.cloud.hypervisor.Hypervisor;
68-
import com.cloud.storage.DataStoreRole;
6967
import com.cloud.storage.StorageManager;
7068
import com.cloud.storage.StorageManagerImpl;
7169
import com.cloud.storage.StoragePoolAutomation;
@@ -129,9 +127,8 @@ public void tearDown() throws Exception {
129127
}
130128

131129
@Test
132-
public void testAttachZone() throws Exception {
130+
public void testAttachZone() {
133131
final DataStore dataStore = mock(DataStore.class);
134-
when(dataStore.getId()).thenReturn(1L);
135132

136133
MockedStatic<ScaleIOGatewayClientConnectionPool> scaleIOGatewayClientConnectionPoolMocked = mockStatic(ScaleIOGatewayClientConnectionPool.class);
137134
ScaleIOGatewayClientImpl client = mock(ScaleIOGatewayClientImpl.class);
@@ -152,12 +149,6 @@ public void testAttachZone() throws Exception {
152149
when(resourceManager.getEligibleUpAndEnabledHostsInZoneForStorageConnection(dataStore, scope.getScopeId(), Hypervisor.HypervisorType.KVM))
153150
.thenReturn(Arrays.asList(host1, host2));
154151

155-
when(dataStoreMgr.getDataStore(anyLong(), eq(DataStoreRole.Primary))).thenReturn(store);
156-
when(store.isShared()).thenReturn(true);
157-
when(store.getStorageProviderName()).thenReturn(ScaleIOUtil.PROVIDER_NAME);
158-
159-
when(dataStoreProviderMgr.getDataStoreProvider(ScaleIOUtil.PROVIDER_NAME)).thenReturn(dataStoreProvider);
160-
when(dataStoreProvider.getName()).thenReturn(ScaleIOUtil.PROVIDER_NAME);
161152
storageMgr.registerHostListener(ScaleIOUtil.PROVIDER_NAME, hostListener);
162153

163154
when(dataStoreHelper.attachZone(Mockito.any(DataStore.class))).thenReturn(null);

0 commit comments

Comments
 (0)