Skip to content

Commit b92c622

Browse files
Gupta, SuryaGupta, Surya
authored andcommitted
CSTACKEX-98 Change the pom for test run
1 parent 8e876d2 commit b92c622

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

plugins/storage/volume/ontap/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<artifactId>maven-surefire-plugin</artifactId>
154154
<version>${maven-surefire-plugin.version}</version>
155155
<configuration>
156-
<skipTests>true</skipTests>
156+
<skipTests>false</skipTests>
157157
<includes>
158158
<include>**/*Test.java</include>
159159
</includes>

plugins/storage/volume/ontap/src/main/test/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycleTest.java

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package org.apache.cloudstack.storage.lifecycle;
2020

21+
import org.apache.cloudstack.storage.utils.Constants;
2122
import org.junit.jupiter.api.BeforeEach;
2223
import org.junit.jupiter.api.Test;
2324
import org.junit.jupiter.api.extension.ExtendWith;
@@ -40,8 +41,6 @@
4041
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
4142
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
4243
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
43-
import org.apache.cloudstack.storage.service.model.AccessGroup;
44-
import com.cloud.hypervisor.Hypervisor;
4544
import java.util.Map;
4645
import java.util.List;
4746
import java.util.ArrayList;
@@ -59,7 +58,7 @@
5958
import org.apache.cloudstack.storage.provider.StorageProviderFactory;
6059
import org.apache.cloudstack.storage.service.StorageStrategy;
6160
import org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper;
62-
import org.apache.cloudstack.storage.utils.Utility;
61+
6362

6463

6564
@ExtendWith(MockitoExtension.class)
@@ -135,17 +134,18 @@ void setUp() {
135134
poolDetails.put("password", "password");
136135
poolDetails.put("svmName", "svm1");
137136
poolDetails.put("protocol", "NFS3");
138-
poolDetails.put("managementLIF", "192.168.1.100");
139-
poolDetails.put("isDisaggregated", "false");
137+
poolDetails.put("storage_ip", "192.168.1.100");
140138
}
141139

142140
@Test
143141
public void testInitialize_positive() {
144-
142+
HashMap<String, String> detailsMap = new HashMap<String, String>();
143+
detailsMap.put(Constants.USERNAME, "testUser");
144+
detailsMap.put(Constants.PASSWORD, "testPassword");
145+
detailsMap.put(Constants.STORAGE_IP, "10.10.10.10");
146+
detailsMap.put(Constants.SVM_NAME, "vs0");
147+
detailsMap.put(Constants.PROTOCOL, "NFS3");
145148
Map<String, Object> dsInfos = new HashMap<>();
146-
dsInfos.put("username", "testUser");
147-
dsInfos.put("password", "testPassword");
148-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1;isDisaggregated=false");
149149
dsInfos.put("zoneId",1L);
150150
dsInfos.put("podId",1L);
151151
dsInfos.put("clusterId", 1L);
@@ -155,7 +155,7 @@ public void testInitialize_positive() {
155155
dsInfos.put("managed",true);
156156
dsInfos.put("tags", "testTag");
157157
dsInfos.put("isTagARule", false);
158-
dsInfos.put("details", new HashMap<String, String>());
158+
dsInfos.put("details", detailsMap);
159159

160160
try(MockedStatic<StorageProviderFactory> storageProviderFactory = Mockito.mockStatic(StorageProviderFactory.class)) {
161161
storageProviderFactory.when(() -> StorageProviderFactory.getStrategy(any())).thenReturn(storageStrategy);
@@ -172,8 +172,12 @@ public void testInitialize_null_Arg() {
172172

173173
@Test
174174
public void testInitialize_missingRequiredDetailKey() {
175+
HashMap<String, String> detailsMap = new HashMap<String, String>();
176+
detailsMap.put(Constants.USERNAME, "testUser");
177+
detailsMap.put(Constants.PASSWORD, "testPassword");
178+
detailsMap.put(Constants.STORAGE_IP, "10.10.10.10");
179+
detailsMap.put(Constants.SVM_NAME, "vs0");
175180
Map<String, Object> dsInfos = new HashMap<>();
176-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1");
177181
dsInfos.put("zoneId",1L);
178182
dsInfos.put("podId",1L);
179183
dsInfos.put("clusterId", 1L);
@@ -183,7 +187,7 @@ public void testInitialize_missingRequiredDetailKey() {
183187
dsInfos.put("managed",true);
184188
dsInfos.put("tags", "testTag");
185189
dsInfos.put("isTagARule", false);
186-
dsInfos.put("details", new HashMap<String, String>());
190+
dsInfos.put("details", detailsMap);
187191

188192
try (MockedStatic<StorageProviderFactory> storageProviderFactory = Mockito.mockStatic(StorageProviderFactory.class)) {
189193
storageProviderFactory.when(() -> StorageProviderFactory.getStrategy(any())).thenReturn(storageStrategy);
@@ -194,8 +198,14 @@ public void testInitialize_missingRequiredDetailKey() {
194198

195199
@Test
196200
public void testInitialize_invalidCapacityBytes() {
201+
HashMap<String, String> detailsMap = new HashMap<String, String>();
202+
detailsMap.put(Constants.USERNAME, "testUser");
203+
detailsMap.put(Constants.PASSWORD, "testPassword");
204+
detailsMap.put(Constants.STORAGE_IP, "10.10.10.10");
205+
detailsMap.put(Constants.SVM_NAME, "vs0");
206+
detailsMap.put(Constants.PROTOCOL, "NFS3");
207+
197208
Map<String, Object> dsInfos = new HashMap<>();
198-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1;isDisaggregated=false");
199209
dsInfos.put("zoneId",1L);
200210
dsInfos.put("podId",1L);
201211
dsInfos.put("clusterId", 1L);
@@ -205,7 +215,7 @@ public void testInitialize_invalidCapacityBytes() {
205215
dsInfos.put("managed",true);
206216
dsInfos.put("tags", "testTag");
207217
dsInfos.put("isTagARule", false);
208-
dsInfos.put("details", new HashMap<String, String>());
218+
dsInfos.put("details", detailsMap);
209219

210220
try (MockedStatic<StorageProviderFactory> storageProviderFactory = Mockito.mockStatic(StorageProviderFactory.class)) {
211221
storageProviderFactory.when(() -> StorageProviderFactory.getStrategy(any())).thenReturn(storageStrategy);
@@ -216,7 +226,6 @@ public void testInitialize_invalidCapacityBytes() {
216226
@Test
217227
public void testInitialize_unmanagedStorage() {
218228
Map<String, Object> dsInfos = new HashMap<>();
219-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1;isDisaggregated=false");
220229
dsInfos.put("zoneId",1L);
221230
dsInfos.put("podId",1L);
222231
dsInfos.put("clusterId", 1L);
@@ -240,7 +249,6 @@ public void testInitialize_unmanagedStorage() {
240249
@Test
241250
public void testInitialize_nullStoragePoolName() {
242251
Map<String, Object> dsInfos = new HashMap<>();
243-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1;isDisaggregated=false");
244252
dsInfos.put("zoneId",1L);
245253
dsInfos.put("podId",1L);
246254
dsInfos.put("clusterId", 1L);
@@ -264,7 +272,6 @@ public void testInitialize_nullStoragePoolName() {
264272
@Test
265273
public void testInitialize_nullProviderName() {
266274
Map<String, Object> dsInfos = new HashMap<>();
267-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1;isDisaggregated=false");
268275
dsInfos.put("zoneId",1L);
269276
dsInfos.put("podId",1L);
270277
dsInfos.put("clusterId", 1L);
@@ -288,7 +295,6 @@ public void testInitialize_nullProviderName() {
288295
@Test
289296
public void testInitialize_nullPodAndClusterAndZone() {
290297
Map<String, Object> dsInfos = new HashMap<>();
291-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1;isDisaggregated=false");
292298
dsInfos.put("zoneId",null);
293299
dsInfos.put("podId",null);
294300
dsInfos.put("clusterId", null);
@@ -316,7 +322,6 @@ public void testInitialize_clusterNotKVM() {
316322
when(_clusterDao.findById(2L)).thenReturn(clusterVO);
317323

318324
Map<String, Object> dsInfos = new HashMap<>();
319-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1;isDisaggregated=false");
320325
dsInfos.put("zoneId",1L);
321326
dsInfos.put("podId",1L);
322327
dsInfos.put("clusterId", 2L);
@@ -338,10 +343,16 @@ public void testInitialize_clusterNotKVM() {
338343
}
339344

340345
@Test
341-
@Ig
342346
public void testInitialize_unexpectedDetailKey() {
347+
HashMap<String, String> detailsMap = new HashMap<String, String>();
348+
detailsMap.put(Constants.USERNAME, "testUser");
349+
detailsMap.put(Constants.PASSWORD, "testPassword");
350+
detailsMap.put(Constants.STORAGE_IP, "10.10.10.10");
351+
detailsMap.put(Constants.SVM_NAME, "vs0");
352+
detailsMap.put(Constants.PROTOCOL, "NFS3");
353+
detailsMap.put("unexpectedKey", "unexpectedValue");
343354
Map<String, Object> dsInfos = new HashMap<>();
344-
dsInfos.put("url", "username=testUser;password=testPassword;svmName=testSVM;protocol=NFS3;managementLIF=192.168.1.1;isDisaggregated=false;unexpectedKey=unexpectedValue");
355+
345356
dsInfos.put("zoneId",1L);
346357
dsInfos.put("podId",1L);
347358
dsInfos.put("clusterId", 1L);
@@ -359,7 +370,7 @@ public void testInitialize_unexpectedDetailKey() {
359370
ontapPrimaryDatastoreLifecycle.initialize(dsInfos);
360371
}
361372
});
362-
assertTrue(ex.getMessage().contains("Unexpected ONTAP detail key in URL"));
373+
assertTrue(ex.getMessage().contains("Unexpected ONTAP detail key"));
363374
}
364375

365376
}

0 commit comments

Comments
 (0)