Skip to content

Commit bb4c373

Browse files
authored
Merge pull request #1133 from oracle/checkstylefix
OWLS-75458, fixed failing tests
2 parents 6ead511 + 42b0a43 commit bb4c373

File tree

1 file changed

+67
-64
lines changed

1 file changed

+67
-64
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/ItUsabilityOperatorHelmChart.java

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import java.util.ArrayList;
88
import java.util.Map;
9-
109
import oracle.kubernetes.operator.utils.Domain;
1110
import oracle.kubernetes.operator.utils.ExecCommand;
1211
import oracle.kubernetes.operator.utils.ExecResult;
@@ -17,7 +16,6 @@
1716
import org.junit.Assume;
1817
import org.junit.BeforeClass;
1918
import org.junit.FixMethodOrder;
20-
import org.junit.Ignore;
2119
import org.junit.Test;
2220
import org.junit.runners.MethodSorters;
2321

@@ -133,17 +131,17 @@ public void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() throws
133131
Operator firstoperator = null;
134132
Operator secondoperator = null;
135133

134+
logger.info("Creating first operator");
135+
firstoperator =
136+
new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
137+
firstoperator.callHelmInstall();
138+
number = number + 1;
139+
oprelease = "op" + number;
140+
logger.info(" new value for oprelease" + oprelease);
141+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
142+
operatorMap.replace("namespace", firstoperator.getOperatorMap().get("namespace"));
143+
secondoperator = new Operator(operatorMap, false, true, true, RestCertType.SELF_SIGNED);
136144
try {
137-
logger.info("Creating firs toperator");
138-
firstoperator =
139-
new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
140-
firstoperator.callHelmInstall();
141-
number = number + 1;
142-
oprelease = "op" + number;
143-
logger.info(" new value for oprelease" + oprelease);
144-
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
145-
operatorMap.replace("namespace", firstoperator.getOperatorMap().get("namespace"));
146-
secondoperator = new Operator(operatorMap, false, true, true, RestCertType.SELF_SIGNED);
147145
secondoperator.callHelmInstall();
148146
throw new RuntimeException(
149147
"FAILURE: Helm installs second operator with same namespace as the first one");
@@ -184,32 +182,29 @@ public void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() throws
184182
* @throws Exception exception
185183
*/
186184
@Test
187-
@Ignore
188185
public void testNotPreCreatedOpNsCreateOperatorNegativeInstall() throws Exception {
189186
Assume.assumeFalse(QUICKTEST);
190187
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
191188
logTestBegin(testMethodName);
192189
Operator operator = null;
190+
191+
operator =
192+
new Operator(
193+
(TestUtils.createOperatorMap(number, false)),
194+
true,
195+
false,
196+
true,
197+
RestCertType.SELF_SIGNED);
198+
String command = " kubectl delete namespace weblogic-operator" + number;
199+
TestUtils.exec(command);
193200
try {
194-
operator =
195-
new Operator(
196-
(TestUtils.createOperatorMap(number, false)), false, false, true, RestCertType.NONE);
197201
operator.callHelmInstall();
198202
throw new RuntimeException("FAILURE: Helm install operator with not preexisted namespace ");
199203

200204
} catch (Exception ex) {
201-
String cmdLb = "helm list --failed " + " | grep " + oprelease;
202-
logger.info("Executing cmd " + cmdLb);
203-
ExecResult result = ExecCommand.exec(cmdLb);
204-
if (result.exitValue() != 0) {
205-
throw new RuntimeException(
206-
"FAILURE: Helm installs operator with not preexisted namespace ");
207-
}
205+
logger.info("Helm install operator with not preexisted ns failed as expected");
208206
} finally {
209207
number++;
210-
if (operator != null) {
211-
operator.destroy();
212-
}
213208
}
214209
logger.info("SUCCESS - " + testMethodName);
215210
}
@@ -221,16 +216,20 @@ public void testNotPreCreatedOpNsCreateOperatorNegativeInstall() throws Exceptio
221216
* @throws Exception exception
222217
*/
223218
@Test
224-
@Ignore
225219
public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() throws Exception {
226220
Assume.assumeFalse(QUICKTEST);
227221
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
228222
logTestBegin(testMethodName);
229223
Operator operator = null;
224+
225+
operator =
226+
new Operator(
227+
(TestUtils.createOperatorMap(number, false)),
228+
true,
229+
false,
230+
true,
231+
RestCertType.SELF_SIGNED);
230232
try {
231-
operator =
232-
new Operator(
233-
(TestUtils.createOperatorMap(number, false)), true, false, true, RestCertType.NONE);
234233
operator.callHelmInstall();
235234
throw new RuntimeException(
236235
"FAILURE: Helm installs operator with not preexisted service account ");
@@ -240,8 +239,7 @@ public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() thr
240239
logger.info("Executing cmd " + cmdLb);
241240
ExecResult result = ExecCommand.exec(cmdLb);
242241
if (result.exitValue() != 0) {
243-
throw new RuntimeException(
244-
"FAILURE: Helm installs operator with not preexisted service account ");
242+
throw new RuntimeException("FAILURE: failed helm is not showed in the failed list ");
245243
}
246244
// create operator service account
247245
String serviceAccount = (String) operator.getOperatorMap().get("serviceAccount");
@@ -279,25 +277,25 @@ public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() thr
279277
* @throws Exception exception
280278
*/
281279
@Test
282-
@Ignore
283280
public void testSecondOpSharingSameTargetDomainsNsNegativeInstall() throws Exception {
284281
Assume.assumeFalse(QUICKTEST);
285282
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
286283
logTestBegin(testMethodName);
287284
Operator secondoperator = null;
288285
Operator firstoperator = null;
286+
287+
logger.info("Creating first operator");
288+
firstoperator =
289+
new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
290+
firstoperator.callHelmInstall();
291+
number = number + 1;
292+
oprelease = "op" + number;
293+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, false);
294+
ArrayList<String> targetDomainsNS =
295+
(ArrayList<String>) firstoperator.getOperatorMap().get("domainNamespaces");
296+
operatorMap.put("domainNamespaces", targetDomainsNS);
297+
secondoperator = new Operator(operatorMap, true, true, false, RestCertType.SELF_SIGNED);
289298
try {
290-
logger.info("Creating first operator");
291-
firstoperator =
292-
new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
293-
firstoperator.callHelmInstall();
294-
number = number + 1;
295-
oprelease = "op" + number;
296-
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, false);
297-
ArrayList<String> targetDomainsNS =
298-
(ArrayList<String>) firstoperator.getOperatorMap().get("domainNamespaces");
299-
operatorMap.put("domainNamespaces", targetDomainsNS);
300-
secondoperator = new Operator(operatorMap, true, true, false, RestCertType.NONE);
301299
secondoperator.callHelmInstall();
302300
throw new RuntimeException(
303301
"FAILURE: Helm installs second operator with same as first operator's target domains namespaces ");
@@ -342,20 +340,23 @@ public void testSecondOpSharingSameTargetDomainsNsNegativeInstall() throws Excep
342340
* @throws Exception exception
343341
*/
344342
@Test
345-
@Ignore
346343
public void testTargetNsIsNotPreexistedNegativeInstall() throws Exception {
347344
Assume.assumeFalse(QUICKTEST);
348345
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
349346
logTestBegin(testMethodName);
350347
Operator operator = null;
348+
349+
operator =
350+
new Operator(
351+
TestUtils.createOperatorMap(number, false),
352+
true,
353+
true,
354+
false,
355+
RestCertType.SELF_SIGNED);
351356
try {
352-
operator =
353-
new Operator(
354-
TestUtils.createOperatorMap(number, false), true, true, false, RestCertType.NONE);
355357
operator.callHelmInstall();
356358
throw new RuntimeException(
357359
"FAILURE: Helm install operator with not preexisted target domains namespaces ");
358-
359360
} catch (Exception ex) {
360361
if (!ex.getMessage()
361362
.contains(
@@ -401,18 +402,19 @@ public void testSecondOpSharingSameExternalRestPortNegativeInstall() throws Exce
401402
Operator operator1 = null;
402403
Operator operator2 = null;
403404
int httpsRestPort = 0;
404-
try {
405-
operator1 = new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
406-
operator1.callHelmInstall();
407405

408-
httpsRestPort = (int) operator1.getOperatorMap().get("externalRestHttpsPort");
409-
logger.info("Creating second operator with externalRestHttpPort " + httpsRestPort);
410-
number = number + 1;
411-
oprelease = "op" + number;
412-
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
413-
operatorMap.replace("externalRestHttpsPort", httpsRestPort);
406+
operator1 = new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
407+
operator1.callHelmInstall();
408+
409+
httpsRestPort = (int) operator1.getOperatorMap().get("externalRestHttpsPort");
410+
logger.info("Creating second operator with externalRestHttpPort " + httpsRestPort);
411+
number = number + 1;
412+
oprelease = "op" + number;
413+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
414+
operatorMap.replace("externalRestHttpsPort", httpsRestPort);
414415

415-
operator2 = new Operator(operatorMap, RestCertType.SELF_SIGNED);
416+
operator2 = new Operator(operatorMap, RestCertType.SELF_SIGNED);
417+
try {
416418
operator2.callHelmInstall();
417419

418420
throw new RuntimeException(
@@ -459,12 +461,13 @@ public void testCreateWithUpperCaseTargetDomainNegativeInstall() throws Exceptio
459461
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
460462
logTestBegin(testMethodName);
461463
Operator operator = null;
464+
465+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
466+
ArrayList<String> targetDomainsNS = new ArrayList<String>();
467+
targetDomainsNS.add("Test9");
468+
operatorMap.replace("domainNamespaces", targetDomainsNS);
469+
operator = new Operator(operatorMap, RestCertType.SELF_SIGNED);
462470
try {
463-
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
464-
ArrayList<String> targetDomainsNS = new ArrayList<String>();
465-
targetDomainsNS.add("Test9");
466-
operatorMap.replace("domainNamespaces", targetDomainsNS);
467-
operator = new Operator(operatorMap, RestCertType.SELF_SIGNED);
468471
operator.callHelmInstall();
469472
throw new RuntimeException(
470473
"FAILURE: Helm install operator with UpperCase for target domains ");

0 commit comments

Comments
 (0)