Skip to content

Commit 1d7a907

Browse files
committed
fixed the tests
1 parent eaa5ed3 commit 1d7a907

File tree

1 file changed

+65
-56
lines changed

1 file changed

+65
-56
lines changed

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

Lines changed: 65 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
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;
1312
import oracle.kubernetes.operator.utils.Operator;
1413
import oracle.kubernetes.operator.utils.Operator.RestCertType;
1514
import oracle.kubernetes.operator.utils.TestUtils;
16-
import org.junit.AfterClass;
1715
import org.junit.Assume;
1816
import org.junit.BeforeClass;
1917
import org.junit.FixMethodOrder;
20-
import org.junit.Ignore;
2118
import org.junit.Test;
2219
import org.junit.runners.MethodSorters;
2320

@@ -54,7 +51,7 @@ public static void staticPrepare() throws Exception {
5451
*
5552
* @throws Exception exception
5653
*/
57-
@AfterClass
54+
// @AfterClass
5855
public static void staticUnPrepare() throws Exception {
5956
if (!QUICKTEST) {
6057
logger.info("+++++++++++++++++++++++++++++++++---------------------------------+");
@@ -133,17 +130,17 @@ public void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() throws
133130
Operator firstoperator = null;
134131
Operator secondoperator = null;
135132

133+
logger.info("Creating firs toperator");
134+
firstoperator =
135+
new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
136+
firstoperator.callHelmInstall();
137+
number = number + 1;
138+
oprelease = "op" + number;
139+
logger.info(" new value for oprelease" + oprelease);
140+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
141+
operatorMap.replace("namespace", firstoperator.getOperatorMap().get("namespace"));
142+
secondoperator = new Operator(operatorMap, false, true, true, RestCertType.SELF_SIGNED);
136143
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);
147144
secondoperator.callHelmInstall();
148145
throw new RuntimeException(
149146
"FAILURE: Helm installs second operator with same namespace as the first one");
@@ -184,16 +181,20 @@ public void testCreateSecondOperatorUsingSameOperatorNsNegativeInstall() throws
184181
* @throws Exception exception
185182
*/
186183
@Test
187-
@Ignore
188184
public void testNotPreCreatedOpNsCreateOperatorNegativeInstall() throws Exception {
189185
Assume.assumeFalse(QUICKTEST);
190186
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
191187
logTestBegin(testMethodName);
192188
Operator operator = null;
189+
190+
operator =
191+
new Operator(
192+
(TestUtils.createOperatorMap(number, false)),
193+
false,
194+
false,
195+
true,
196+
RestCertType.SELF_SIGNED);
193197
try {
194-
operator =
195-
new Operator(
196-
(TestUtils.createOperatorMap(number, false)), false, false, true, RestCertType.NONE);
197198
operator.callHelmInstall();
198199
throw new RuntimeException("FAILURE: Helm install operator with not preexisted namespace ");
199200

@@ -221,16 +222,20 @@ public void testNotPreCreatedOpNsCreateOperatorNegativeInstall() throws Exceptio
221222
* @throws Exception exception
222223
*/
223224
@Test
224-
@Ignore
225225
public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() throws Exception {
226226
Assume.assumeFalse(QUICKTEST);
227227
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
228228
logTestBegin(testMethodName);
229229
Operator operator = null;
230+
231+
operator =
232+
new Operator(
233+
(TestUtils.createOperatorMap(number, false)),
234+
true,
235+
false,
236+
true,
237+
RestCertType.SELF_SIGNED);
230238
try {
231-
operator =
232-
new Operator(
233-
(TestUtils.createOperatorMap(number, false)), true, false, true, RestCertType.NONE);
234239
operator.callHelmInstall();
235240
throw new RuntimeException(
236241
"FAILURE: Helm installs operator with not preexisted service account ");
@@ -240,8 +245,7 @@ public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() thr
240245
logger.info("Executing cmd " + cmdLb);
241246
ExecResult result = ExecCommand.exec(cmdLb);
242247
if (result.exitValue() != 0) {
243-
throw new RuntimeException(
244-
"FAILURE: Helm installs operator with not preexisted service account ");
248+
throw new RuntimeException("FAILURE: failed helm is not showed in the failed list ");
245249
}
246250
// create operator service account
247251
String serviceAccount = (String) operator.getOperatorMap().get("serviceAccount");
@@ -279,25 +283,25 @@ public void testNotPreexistedOpServiceAccountCreateOperatorNegativeInstall() thr
279283
* @throws Exception exception
280284
*/
281285
@Test
282-
@Ignore
283286
public void testSecondOpSharingSameTargetDomainsNsNegativeInstall() throws Exception {
284287
Assume.assumeFalse(QUICKTEST);
285288
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
286289
logTestBegin(testMethodName);
287290
Operator secondoperator = null;
288291
Operator firstoperator = null;
292+
293+
logger.info("Creating first operator");
294+
firstoperator =
295+
new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
296+
firstoperator.callHelmInstall();
297+
number = number + 1;
298+
oprelease = "op" + number;
299+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, false);
300+
ArrayList<String> targetDomainsNS =
301+
(ArrayList<String>) firstoperator.getOperatorMap().get("domainNamespaces");
302+
operatorMap.put("domainNamespaces", targetDomainsNS);
303+
secondoperator = new Operator(operatorMap, true, true, false, RestCertType.SELF_SIGNED);
289304
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);
301305
secondoperator.callHelmInstall();
302306
throw new RuntimeException(
303307
"FAILURE: Helm installs second operator with same as first operator's target domains namespaces ");
@@ -342,20 +346,23 @@ public void testSecondOpSharingSameTargetDomainsNsNegativeInstall() throws Excep
342346
* @throws Exception exception
343347
*/
344348
@Test
345-
@Ignore
346349
public void testTargetNsIsNotPreexistedNegativeInstall() throws Exception {
347350
Assume.assumeFalse(QUICKTEST);
348351
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
349352
logTestBegin(testMethodName);
350353
Operator operator = null;
354+
355+
operator =
356+
new Operator(
357+
TestUtils.createOperatorMap(number, false),
358+
true,
359+
true,
360+
false,
361+
RestCertType.SELF_SIGNED);
351362
try {
352-
operator =
353-
new Operator(
354-
TestUtils.createOperatorMap(number, false), true, true, false, RestCertType.NONE);
355363
operator.callHelmInstall();
356364
throw new RuntimeException(
357365
"FAILURE: Helm install operator with not preexisted target domains namespaces ");
358-
359366
} catch (Exception ex) {
360367
if (!ex.getMessage()
361368
.contains(
@@ -401,18 +408,19 @@ public void testSecondOpSharingSameExternalRestPortNegativeInstall() throws Exce
401408
Operator operator1 = null;
402409
Operator operator2 = null;
403410
int httpsRestPort = 0;
404-
try {
405-
operator1 = new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
406-
operator1.callHelmInstall();
407411

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);
412+
operator1 = new Operator(TestUtils.createOperatorMap(number, true), RestCertType.SELF_SIGNED);
413+
operator1.callHelmInstall();
414414

415-
operator2 = new Operator(operatorMap, RestCertType.SELF_SIGNED);
415+
httpsRestPort = (int) operator1.getOperatorMap().get("externalRestHttpsPort");
416+
logger.info("Creating second operator with externalRestHttpPort " + httpsRestPort);
417+
number = number + 1;
418+
oprelease = "op" + number;
419+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
420+
operatorMap.replace("externalRestHttpsPort", httpsRestPort);
421+
422+
operator2 = new Operator(operatorMap, RestCertType.SELF_SIGNED);
423+
try {
416424
operator2.callHelmInstall();
417425

418426
throw new RuntimeException(
@@ -459,12 +467,13 @@ public void testCreateWithUpperCaseTargetDomainNegativeInstall() throws Exceptio
459467
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
460468
logTestBegin(testMethodName);
461469
Operator operator = null;
470+
471+
Map<String, Object> operatorMap = TestUtils.createOperatorMap(number, true);
472+
ArrayList<String> targetDomainsNS = new ArrayList<String>();
473+
targetDomainsNS.add("Test9");
474+
operatorMap.replace("domainNamespaces", targetDomainsNS);
475+
operator = new Operator(operatorMap, RestCertType.SELF_SIGNED);
462476
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);
468477
operator.callHelmInstall();
469478
throw new RuntimeException(
470479
"FAILURE: Helm install operator with UpperCase for target domains ");

0 commit comments

Comments
 (0)