Skip to content

Commit 09932c2

Browse files
committed
Merge remote-tracking branch 'origin/develop' into chshi-OWLS-67963-upd-del-sh
2 parents 50a3d2c + 6fcb36e commit 09932c2

File tree

19 files changed

+180
-133
lines changed

19 files changed

+180
-133
lines changed

integration-tests/README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,29 @@ Quick test use cases.
2626
6. verify domain life cycle(destroy and create) should not any impact on Operator managing the domain and web app load balancing and admin external service
2727
7. cluster scale up/down using Operator REST endpoint, webapp load balancing should adjust accordingly. (run.sh does scaling by editing the replicas in domain-custom-resource.yaml.)
2828
8. Operator life cycle(destroy and create) should not impact the running domain
29+
9. verify liveness probe by killing managed server 1 process 3 times to kick pod auto-restart
30+
10. shutdown the domain by changing domain serverStartPolicy to NEVER
2931

3032
Full test use cases
3133

32-
* keep the first domain and operator running
34+
* keep the first operator running
3335
* create another domain domain2 in default namespace and verify the domain by doing the checks 2 - 5 listed in quick test
34-
* destroy domain domain2
36+
* shutdown and delete domain domain2
3537
* create another domain domain3 with dynamic cluster using WDT in test1 namespace and verify the domain by doing the checks 2 - 5 listed in quick test
3638
* verify cluster scaling by doing scale up for domain3 using WLDF scaling
37-
* destroy domain domain3
39+
* shutdown and delete domain domain3
3840
* create another operator operator2 which manages test2 namespace and verify domain1 is not affected
39-
* create another domain domain4 with Configured cluster using WDT in test2 namespace and verify the domain by doing the checks 2 - 5 listed in quick test
40-
* verify scaling for domain4 cluster from 2 to 3 servers and back to 2, plus verify no impact on domain1
41-
* cycle domain1 down and back up, plus verify no impact on domain4
42-
* create domain5 in the default namespace with serverStartPolicy="ADMIN_ONLY", and verify that only admin server is created. on Jenkins, this domain will also test NFS instead of HOSTPATH PV storage
43-
* create domain6 in the default namespace with pvReclaimPolicy="Recycle", and verify that the PV is deleted once the domain and PVC are deleted
44-
* test managed server 1 pod auto-restart in domain1
45-
* destroy domain1
46-
* test that create domain fails when its pv is already populated by a shutdown domain
47-
* create another domain domain7 with APACHE load balancer and access admin console via LB port.
48-
* create another domain domain8 with mostly default values from sample domain inputs, mainly exposeAdminT3Channel and exposeAdminNodePort which are false by default and verify domain startup and cluster scaling using operator rest endpoint works.
41+
* create another domain domain4 with dynamic cluster in default namespace and domain domain5 with Configured cluster using WDT in test2 namespace and verify the domain by doing the checks 2 - 5 listed in quick test
42+
* verify scaling for domain5 cluster from 2 to 3 servers and back to 2, plus verify no impact on domain4
43+
* cycle domain4 down and back up, plus verify no impact on domain5
44+
* shutdown and delete both domain4 and domain5
45+
* create domain6 in the default namespace with serverStartPolicy="ADMIN_ONLY", and verify that only admin server is created. on Jenkins, this domain will also test NFS instead of HOSTPATH PV storage
46+
* shutdown and delete domain6
47+
* create domain7 in the default namespace with pvReclaimPolicy="Recycle", and verify that the PV is deleted once the domain and PVC are deleted
48+
* shutdown and delete domain7
49+
* create domain domain8 and test that create domain fails when its pv is already populated by a shutdown domain
50+
* create another domain domain9 with APACHE load balancer and access admin console via LB port. shutdown domain.
51+
* create another domain domain10 with mostly default values from sample domain inputs, mainly exposeAdminT3Channel and exposeAdminNodePort which are false by default and verify domain startup and cluster scaling using operator rest endpoint works.
4952

5053

5154
# Directory Configuration and Structure

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

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ public class ITOperator extends BaseTest {
4343
private static final String domain1ForDelValueYamlFile = "domain_del_1.yaml";
4444
private static final String domain2ForDelValueYamlFile = "domain_del_2.yaml";
4545
private static final String domain3ForDelValueYamlFile = "domain_del_3.yaml";
46+
private static String domain9YamlFile = "domain9.yaml";
47+
private static String domain10YamlFile = "domain10.yaml";
4648

4749
// property file used to configure constants for integration tests
4850
private static String appPropsFile = "OperatorIT.properties";
4951

5052
private static Operator operator1, operator2;
51-
private static Domain domain1;
5253

5354
private static Operator operatorForDel1;
5455
private static Operator operatorForDel2;
@@ -101,9 +102,9 @@ public void test1CreateFirstOperatorAndDomain() throws Exception {
101102

102103
logTestBegin("test1CreateFirstOperatorAndDomain");
103104
testCreateOperatorManagingDefaultAndTest1NS();
104-
domain1 = testAllUseCasesForADomain(operator1, domain1YamlFile);
105+
Domain domain1 = testAllUseCasesForADomain(operator1, domain1YamlFile);
105106
domain1.testWlsLivenessProbe();
106-
domain1.destroy();
107+
domain1.shutdownUsingServerStartPolicy();
107108

108109
logger.info("SUCCESS - test1CreateFirstOperatorAndDomain");
109110
}
@@ -167,34 +168,31 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
167168
if (operator1 == null) {
168169
operator1 = TestUtils.createOperator(op1YamlFile);
169170
}
170-
if (domain1 == null) {
171-
domain1 = TestUtils.createDomain(domain1YamlFile);
172-
} else {
173-
domain1.create();
174-
}
171+
Domain domain4 = TestUtils.createDomain(domain4YamlFile);
172+
175173
logger.info("Checking if operator2 is running, if not creating");
176174
if (operator2 == null) {
177175
operator2 = TestUtils.createOperator(op2YamlFile);
178176
}
179-
// create domain4
180-
Domain domain4 = testDomainCreation(domain4YamlFile);
177+
// create domain5 with configured cluster
178+
Domain domain5 = testDomainCreation(domain5YamlFile);
181179

182-
logger.info("Verify the only remaining running domain domain1 is unaffected");
183-
domain1.verifyDomainCreated();
180+
logger.info("Verify the only remaining running domain domain4 is unaffected");
181+
domain4.verifyDomainCreated();
184182

185-
testClusterScaling(operator2, domain4);
183+
testClusterScaling(operator2, domain5);
186184

187-
logger.info("Verify the only remaining running domain domain1 is unaffected");
188-
domain1.verifyDomainCreated();
185+
logger.info("Verify the only remaining running domain domain4 is unaffected");
186+
domain4.verifyDomainCreated();
189187

190-
logger.info("Destroy and create domain1 and verify no impact on domain4");
191-
domain1.destroy();
192-
domain1.create();
188+
logger.info("Destroy and create domain4 and verify no impact on domain5");
189+
domain4.destroy();
190+
domain4.create();
193191

194-
logger.info("Verify no impact on domain4");
195-
domain4.verifyDomainCreated();
192+
logger.info("Verify no impact on domain5");
193+
domain5.verifyDomainCreated();
194+
domain5.destroy();
196195
domain4.destroy();
197-
domain1.destroy();
198196
logger.info("SUCCESS - test5CreateConfiguredDomainInTest2NS");
199197
}
200198

@@ -208,10 +206,10 @@ public void test6CreateDomainWithStartPolicyAdminOnly() throws Exception {
208206
if (operator1 == null) {
209207
operator1 = TestUtils.createOperator(op1YamlFile);
210208
}
211-
logger.info("Creating Domain domain5 & verifing the domain creation");
212-
// create domain5
213-
Domain domain5 = TestUtils.createDomain(domain5YamlFile);
214-
domain5.destroy();
209+
logger.info("Creating Domain domain6 & verifing the domain creation");
210+
// create domain6
211+
Domain domain6 = TestUtils.createDomain(domain6YamlFile);
212+
domain6.destroy();
215213
logger.info("SUCCESS - test6CreateDomainWithStartPolicyAdminOnly");
216214
}
217215

@@ -225,47 +223,46 @@ public void test7CreateDomainPVReclaimPolicyRecycle() throws Exception {
225223
if (operator1 == null) {
226224
operator1 = TestUtils.createOperator(op1YamlFile);
227225
}
228-
logger.info("Creating Domain domain6 & verifing the domain creation");
229-
// create domain6
230-
Domain domain6 = TestUtils.createDomain(domain6YamlFile);
231-
domain6.shutdown();
232-
domain6.deletePVCAndCheckPVReleased();
226+
logger.info("Creating Domain domain7 & verifing the domain creation");
227+
// create domain7
228+
Domain domain7 = TestUtils.createDomain(domain7YamlFile);
229+
domain7.shutdown();
230+
domain7.deletePVCAndCheckPVReleased();
233231
logger.info("SUCCESS - test7CreateDomainPVReclaimPolicyRecycle");
234232
}
235233

236234
@Test
237-
public void test9CreateDomainOnExistingDir() throws Exception {
235+
public void test8CreateDomainOnExistingDir() throws Exception {
238236
Assume.assumeFalse(
239237
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
240238

241-
logTestBegin("test9CreateDomainOnExistingDir");
239+
logTestBegin("test8CreateDomainOnExistingDir");
242240
if (operator1 == null) {
243241
operator1 = TestUtils.createOperator(op1YamlFile);
244242
}
245-
if (domain1 == null) {
246-
domain1 = TestUtils.createDomain(domain1YamlFile);
247-
// create domain on existing dir
248-
domain1.destroy();
249-
}
250-
logger.info("domain1 " + domain1);
251-
domain1.createDomainOnExistingDirectory();
252-
logger.info("SUCCESS - test9CreateDomainOnExistingDir");
243+
244+
Domain domain8 = TestUtils.createDomain(domain8YamlFile);
245+
// create domain on existing dir
246+
domain8.destroy();
247+
248+
domain8.createDomainOnExistingDirectory();
249+
logger.info("SUCCESS - test8CreateDomainOnExistingDir");
253250
}
254251

255252
// @Test
256253
public void testACreateDomainApacheLB() throws Exception {
257254
Assume.assumeFalse(
258255
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
259256
logTestBegin("testACreateDomainApacheLB");
260-
logger.info("Creating Domain domain7 & verifing the domain creation");
257+
logger.info("Creating Domain domain9 & verifing the domain creation");
261258
if (operator1 == null) {
262259
operator1 = TestUtils.createOperator(op1YamlFile);
263260
}
264261

265262
// create domain7
266-
Domain domain7 = TestUtils.createDomain(domain7YamlFile);
267-
domain7.verifyAdminConsoleViaLB();
268-
domain7.destroy();
263+
Domain domain9 = TestUtils.createDomain(domain9YamlFile);
264+
domain9.verifyAdminConsoleViaLB();
265+
domain9.destroy();
269266
logger.info("SUCCESS - testACreateDomainApacheLB");
270267
}
271268

@@ -274,14 +271,14 @@ public void testBCreateDomainWithDefaultValuesInSampleInputs() throws Exception
274271
Assume.assumeFalse(
275272
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
276273
logTestBegin("testBCreateDomainWithDefaultValuesInSampleInputs");
277-
logger.info("Creating Domain domain8 & verifing the domain creation");
274+
logger.info("Creating Domain domain10 & verifing the domain creation");
278275
if (operator1 == null) {
279276
operator1 = TestUtils.createOperator(op1YamlFile);
280277
}
281278

282-
// create domain8
283-
Domain domain8 = testAllUseCasesForADomain(operator1, domain8YamlFile);
284-
domain8.destroy();
279+
// create domain10
280+
Domain domain10 = testAllUseCasesForADomain(operator1, domain10YamlFile);
281+
domain10.destroy();
285282
logger.info("SUCCESS - testBCreateDomainWithDefaultValuesInSampleInputs");
286283
}
287284

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

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,26 @@ public void verifyServersReady() throws Exception {
170170
TestUtils.checkPodReady(domainUid + "-" + managedServerNameBase + i, domainNS);
171171
}
172172
}
173+
// check no additional servers are started
174+
if (domainMap.get("serverStartPolicy").toString().trim().equals("ADMIN_ONLY")) {
175+
initialManagedServerReplicas = 0;
176+
}
177+
String additionalManagedServer =
178+
domainUid + "-" + managedServerNameBase + (initialManagedServerReplicas + 1);
179+
logger.info(
180+
"Checking if managed server " + additionalManagedServer + " is started, it should not be");
181+
StringBuffer cmd = new StringBuffer();
182+
cmd.append("kubectl get pod ").append(additionalManagedServer).append(" -n ").append(domainNS);
183+
ExecResult result = ExecCommand.exec(cmd.toString());
184+
185+
if (result.exitValue() == 0 && result.stdout().contains("1/1")) {
186+
throw new RuntimeException(
187+
"FAILURE: Managed Server "
188+
+ additionalManagedServer
189+
+ " is started, but its not expected.");
190+
} else {
191+
logger.info(additionalManagedServer + " is not running, which is expected behaviour");
192+
}
173193
}
174194
/**
175195
* verify nodeport by accessing admin REST endpoint
@@ -391,6 +411,7 @@ public void destroy() throws Exception {
391411
}
392412

393413
public void shutdown() throws Exception {
414+
int replicas = TestUtils.getClusterReplicas(domainUid, clusterName, domainNS);
394415
String cmd = "kubectl delete domain " + domainUid + " -n " + domainNS;
395416
ExecResult result = ExecCommand.exec(cmd);
396417
if (result.exitValue() != 0) {
@@ -399,7 +420,27 @@ public void shutdown() throws Exception {
399420
}
400421
String output = result.stdout().trim();
401422
logger.info("command to delete domain " + cmd + " \n returned " + output);
423+
verifyDomainDeleted(replicas);
402424
}
425+
426+
public void shutdownUsingServerStartPolicy() throws Exception {
427+
int replicas = TestUtils.getClusterReplicas(domainUid, clusterName, domainNS);
428+
String cmd =
429+
"kubectl patch domain "
430+
+ domainUid
431+
+ " -n "
432+
+ domainNS
433+
+ " -p '{\"spec\":{\"serverStartPolicy\":\"NEVER\"}}' --type merge";
434+
ExecResult result = ExecCommand.exec(cmd);
435+
if (result.exitValue() != 0) {
436+
throw new RuntimeException(
437+
"FAILURE: command " + cmd + " failed, returned " + result.stderr());
438+
}
439+
String output = result.stdout().trim();
440+
logger.info("command to shutdown domain " + cmd + " \n returned " + output);
441+
verifyServerPodsDeleted(replicas);
442+
}
443+
403444
/**
404445
* verify domain is deleted
405446
*
@@ -409,8 +450,11 @@ public void shutdown() throws Exception {
409450
public void verifyDomainDeleted(int replicas) throws Exception {
410451
logger.info("Inside verifyDomainDeleted, replicas " + replicas);
411452
TestUtils.checkDomainDeleted(domainUid, domainNS);
412-
TestUtils.checkPodDeleted(domainUid + "-" + adminServerName, domainNS);
453+
verifyServerPodsDeleted(replicas);
454+
}
413455

456+
public void verifyServerPodsDeleted(int replicas) throws Exception {
457+
TestUtils.checkPodDeleted(domainUid + "-" + adminServerName, domainNS);
414458
for (int i = 1; i <= replicas; i++) {
415459
TestUtils.checkPodDeleted(domainUid + "-" + managedServerNameBase + i, domainNS);
416460
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,13 @@ private static int makeOperatorRestCall(
359359
logger.info("Sleeping 5 more seconds and try again");
360360
Thread.sleep(5 * 1000);
361361
continue;
362+
} else {
363+
throw ex;
362364
}
363365
}
364366
break;
365367
}
366-
logger.info("response: " + response.toString());
368+
logger.info("response: " + response);
367369

368370
int returnCode = response.getStatus();
369371
// Verify
@@ -373,10 +375,8 @@ private static int makeOperatorRestCall(
373375
} else {
374376
throw new RuntimeException("Response " + response.readEntity(String.class));
375377
}
376-
377378
response.close();
378379
// javaClient.close();
379-
380380
return returnCode;
381381
}
382382

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
domainUID: domain10
5+
configuredManagedServerCount: 4

integration-tests/src/test/resources/domain4.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@
44
adminServerName: admin-server
55
domainUID: domain4
66
clusterName: cluster-1
7-
clusterType: CONFIGURED
87
configuredManagedServerCount: 4
98
initialManagedServerReplicas: 2
109
managedServerNameBase: managed-server
11-
#weblogicDomainStoragePath will be ignored, PV dir will be created at /<baseDir>/<USER>/acceptance_test_pv
12-
#weblogicDomainStoragePath: /scratch/external-domain-home/pv001/
13-
exposeAdminT3Channel: true
14-
t3ChannelPort: 30051
15-
exposeAdminNodePort: true
16-
adminNodePort: 30704
17-
namespace: test2
18-
createDomainFilesDir: wdt
10+
namespace: default

integration-tests/src/test/resources/domain5.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
adminServerName: admin-server
55
domainUID: domain5
66
clusterName: cluster-1
7-
clusterType: DYNAMIC
7+
clusterType: CONFIGURED
88
configuredManagedServerCount: 4
99
initialManagedServerReplicas: 2
1010
managedServerNameBase: managed-server
1111
#weblogicDomainStoragePath will be ignored, PV dir will be created at /<baseDir>/<USER>/acceptance_test_pv
1212
#weblogicDomainStoragePath: /scratch/external-domain-home/pv001/
1313
exposeAdminT3Channel: true
14-
t3ChannelPort: 30061
14+
t3ChannelPort: 30051
1515
exposeAdminNodePort: true
16-
adminNodePort: 30705
17-
namespace: default
18-
serverStartPolicy: ADMIN_ONLY
16+
adminNodePort: 30704
17+
namespace: test2
18+
createDomainFilesDir: wdt

integration-tests/src/test/resources/domain6.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ managedServerNameBase: managed-server
1111
#weblogicDomainStoragePath will be ignored, PV dir will be created at /<baseDir>/<USER>/acceptance_test_pv
1212
#weblogicDomainStoragePath: /scratch/external-domain-home/pv001/
1313
exposeAdminT3Channel: true
14-
t3ChannelPort: 30071
14+
t3ChannelPort: 30061
1515
exposeAdminNodePort: true
16-
adminNodePort: 30706
16+
adminNodePort: 30705
1717
namespace: default
18-
weblogicDomainStorageReclaimPolicy: Recycle
18+
serverStartPolicy: ADMIN_ONLY

integration-tests/src/test/resources/domain7.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ managedServerNameBase: managed-server
1111
#weblogicDomainStoragePath will be ignored, PV dir will be created at /<baseDir>/<USER>/acceptance_test_pv
1212
#weblogicDomainStoragePath: /scratch/external-domain-home/pv001/
1313
exposeAdminT3Channel: true
14-
t3ChannelPort: 30081
14+
t3ChannelPort: 30071
1515
exposeAdminNodePort: true
16-
adminNodePort: 30707
16+
adminNodePort: 30706
1717
namespace: default
18-
loadBalancer: APACHE
19-
loadBalancerWebPort: 30311
20-
loadBalancerDashboardPort: 30321
18+
weblogicDomainStorageReclaimPolicy: Recycle

0 commit comments

Comments
 (0)