Skip to content

Commit e89c2f4

Browse files
authored
Merge pull request #529 from oracle/feature/java-integration-tests
shutdown domain after test completes successfully
2 parents 37e7821 + 28d2d3d commit e89c2f4

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

integration-tests/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ mvn -Dit.test="ITOperator#test6CreateConfiguredDomainInTest2NS" -DfailIfNoTests=
268268

269269
mvn -Dit.test="ITOperator#test6CreateConfiguredDomainInTest2NS+test7CreateDomainPVReclaimPolicyRecycle" -DfailIfNoTests=false integration-test -P java-integration-tests
270270

271+
# How to run cleanup script
272+
273+
cleanup script deletes the k8s artifacts, local test tmp directory, delete all helm charts and the potentially remote domain pv directories.
274+
cd weblogic-kubernetes-operator
275+
src/integration-tests/bash/cleanup.sh
276+
271277
# Logging/Archiving
272278

273279
Java utils logging is used, writes all the messages to console and java_test_suite.out in $RESULT_ROOT/acceptance_test_tmp directory.

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

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ public void test1CreateFirstOperatorAndDomain() throws Exception {
9494
logTestBegin("test1CreateFirstOperatorAndDomain");
9595
testCreateOperatorManagingDefaultAndTest1NS();
9696
domain1 = testAllUseCasesForADomain(operator1, domain1YamlFile);
97+
domain1.testWlsLivenessProbe();
98+
domain1.destroy();
99+
97100
logger.info("SUCCESS - test1CreateFirstOperatorAndDomain");
98101
}
99102

@@ -128,6 +131,7 @@ public void test3CreateDomainInTest1NS() throws Exception {
128131
// create domain3
129132
Domain domain3 = testDomainCreation(domain3YamlFile);
130133
testWLDFScaling(operator1, domain3);
134+
domain3.destroy();
131135
logger.info("SUCCESS - test3CreateDomainInTest1NS");
132136
}
133137

@@ -157,6 +161,8 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
157161
}
158162
if (domain1 == null) {
159163
domain1 = TestUtils.createDomain(domain1YamlFile);
164+
} else {
165+
domain1.create();
160166
}
161167
logger.info("Checking if operator2 is running, if not creating");
162168
if (operator2 == null) {
@@ -179,6 +185,8 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
179185

180186
logger.info("Verify no impact on domain4");
181187
domain4.verifyDomainCreated();
188+
domain4.destroy();
189+
domain1.destroy();
182190
logger.info("SUCCESS - test5CreateConfiguredDomainInTest2NS");
183191
}
184192

@@ -194,7 +202,8 @@ public void test6CreateDomainWithStartPolicyAdminOnly() throws Exception {
194202
}
195203
logger.info("Creating Domain domain5 & verifing the domain creation");
196204
// create domain5
197-
TestUtils.createDomain(domain5YamlFile);
205+
Domain domain5 = TestUtils.createDomain(domain5YamlFile);
206+
domain5.destroy();
198207
logger.info("SUCCESS - test6CreateDomainWithStartPolicyAdminOnly");
199208
}
200209

@@ -216,25 +225,6 @@ public void test7CreateDomainPVReclaimPolicyRecycle() throws Exception {
216225
logger.info("SUCCESS - test7CreateDomainPVReclaimPolicyRecycle");
217226
}
218227

219-
@Test
220-
public void test8WlsLivenessProbe() throws Exception {
221-
222-
logTestBegin("test8WlsLivenessProbe");
223-
logger.info("Checking if operator1 is running, if not creating");
224-
if (operator1 == null) {
225-
operator1 = TestUtils.createOperator(op1YamlFile);
226-
}
227-
if (domain1 == null) {
228-
domain1 = TestUtils.createDomain(domain1YamlFile);
229-
}
230-
// test managed server1 pod auto restart
231-
String domain = domain1.getDomainUid();
232-
String namespace = domain1.getDomainMap().get("namespace").toString();
233-
String serverName = domain1.getDomainMap().get("managedServerNameBase").toString() + "1";
234-
TestUtils.testWlsLivenessProbe(domain, serverName, namespace);
235-
logger.info("SUCCESS - test8WlsLivenessProbe");
236-
}
237-
238228
@Test
239229
public void test9CreateDomainOnExistingDir() throws Exception {
240230
Assume.assumeFalse(
@@ -246,10 +236,10 @@ public void test9CreateDomainOnExistingDir() throws Exception {
246236
}
247237
if (domain1 == null) {
248238
domain1 = TestUtils.createDomain(domain1YamlFile);
239+
// create domain on existing dir
240+
domain1.destroy();
249241
}
250242
logger.info("domain1 " + domain1);
251-
// create domain on existing dir
252-
domain1.destroy();
253243
domain1.createDomainOnExistingDirectory();
254244
logger.info("SUCCESS - test9CreateDomainOnExistingDir");
255245
}
@@ -267,6 +257,7 @@ public void testACreateDomainApacheLB() throws Exception {
267257
// create domain7
268258
Domain domain7 = TestUtils.createDomain(domain7YamlFile);
269259
domain7.verifyAdminConsoleViaLB();
260+
domain7.destroy();
270261
logger.info("SUCCESS - testACreateDomainApacheLB");
271262
}
272263

@@ -281,7 +272,8 @@ public void testBCreateDomainWithDefaultValuesInSampleInputs() throws Exception
281272
}
282273

283274
// create domain8
284-
testAllUseCasesForADomain(operator1, domain8YamlFile);
275+
Domain domain8 = testAllUseCasesForADomain(operator1, domain8YamlFile);
276+
domain8.destroy();
285277
logger.info("SUCCESS - testBCreateDomainWithDefaultValuesInSampleInputs");
286278
}
287279

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,13 @@ public String getDomainUid() {
510510
return domainUid;
511511
}
512512

513+
public void testWlsLivenessProbe() throws Exception {
514+
515+
// test managed server1 pod auto restart
516+
String serverName = managedServerNameBase + "1";
517+
TestUtils.testWlsLivenessProbe(domainUid, serverName, domainNS);
518+
}
519+
513520
private int getAdminSericeLBNodePort() throws Exception {
514521

515522
String adminServerLBNodePortService = domainUid + "-apache-webtier";

wercker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ integration-test-java:
178178
goals: clean verify
179179
version: 3.5.2
180180
profiles: java-integration-tests
181-
181+
182182
after-steps:
183183
- script:
184184
name: cleanup and store

0 commit comments

Comments
 (0)