Skip to content

Commit fd8d40c

Browse files
authored
Merge pull request #1074 from oracle/jrftest3
add JRFUSECASES.MD
2 parents 802a881 + c3c8ccf commit fd8d40c

File tree

3 files changed

+276
-0
lines changed

3 files changed

+276
-0
lines changed

integration-tests/JRFUSECASES.MD

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Use Cases for FMW Infra Domain in the Operator
2+
3+
Java integration tests cover the following use cases:
4+
5+
## Basic test Configuration & Use Cases
6+
7+
| | |
8+
| --- | --- |
9+
| Operator Configuration | operator1 deployed in `weblogic-operator` namespace and manages domains in `default` and `jrfdomains` namespaces |
10+
| Domain Configuration | Domain on PV using WLST, Traefik load balancer |
11+
12+
**Basic Use Cases**
13+
14+
1. Create operator `weblogic-operator` which manages `default` and `jrfdomains` namespaces, verify it's deployed successfully, pods created, operator ready and verify external REST service, if configured.
15+
2. Create domain `jrfdomain` in `jrfdomains` namespace and verify the pods, services are created and servers are in ready state.
16+
3. Verify the admin external service by accessing the admin REST endpoint with `nodeport` in URL.
17+
4. Verify exec into the admin pod and deploying webapp using the admin port with WLST.
18+
5. Verify web app load balancing by accessing the webapp using `loadBalancerWebPort`.
19+
20+
**Advanced Use Cases**
21+
22+
6. Verify domain life cycle (destroy and create) should not have any impact on operator managing the domain and web app load balancing and admin external service.
23+
7. Cluster scale up/down using operator REST endpoint, webapp load balancing should adjust accordingly.
24+
8. Operator life cycle (destroy and create) should not impact the running domain.
25+
26+
Also the below use cases are covered for each test:
27+
28+
9. Verify the liveness probe by killing managed server 1 process 3 times to kick pod auto-restart.
29+
10. Shutdown the domain by changing domain `serverStartPolicy` to `NEVER`.
30+
31+
32+
## Full test Configuration & Use Cases
33+
34+
Additional Operator Configuration:
35+
36+
| | |
37+
| --- | --- |
38+
| Operator Configuration | `operator2` deployed in `weblogic-operator2` namespace and manages domains in `test2` namespace |
39+
40+
Basic Use Cases described above are verified in all the domain configurations. Also the below use cases are covered:
41+
42+
| Domain | Use Case |
43+
| --- | --- |
44+
| Domain on PV using WLST | as above in basic use cases |
45+
| Domain with ADMIN_ONLY | verify only admin server is started and managed servers are not started. Shutdown domain by deleting domain CRD. Create domain on existing PV dir, pv is already populated by a shutdown domain. |
46+
| Domain with situational config | create domain with listen address not set for admin server and t3 channel/NAP and incorrect file for admin server log location. Introspector should override these with sit-config automatically. Also, with some junk value for t3 channel public address and using custom situational config override replace with valid public address using secret. Also, on Jenkins this domain uses NFS instead of HOSTPATH PV storage |
47+
| Two domains managed by two operators | verify scaling and restart of one domain doesn't impact another domain. Delete domain resources using delete script from samples. |
48+
| Two domains in the same namespace managed by one operator | create two FMW Infra Domains in the same namespace managed by one operator. Verify scaling and restart of one domain doesn't impact another domain. |
49+
| Two domains in the different namespaces managed by one operator | create two FMW Infra Domains in the different namespaces managed by one operator. Domain1 uses VOYAGER load balancer. Domain2 uses TRAEFIK load balancer. Verify scaling and restart of one domain doesn't impact another domain. |
50+
| Domain with Recycle policy | create domain with pvReclaimPolicy="Recycle" and using Configured cluster. Verify that the PV is deleted once the domain and PVC are deleted |
51+
| Domain with default sample values | create domain using mostly default values for inputs |
52+
53+
Test cases cover the bugs found:
54+
55+
| Domain | Use Case |
56+
| --- | --- |
57+
| Domain on PV using WLST | cluster rolling restart with restartVersion and maxUnavailable set to 2, verify the not-ready server counts can not exceed maxUnavailable value |
58+
| Domain on PV using WLST | in create domain input file, set exposeAdminNodePort to false and exposeAdminT3Channel to true, verify the managed server pods are created |
59+
| Domain on PV using WLST | in create domain input file, set createDomainScriptsMountPath to non-default value, verify the create domain sample script works |
60+
| Domain on PV using WLST | in createFMWDomain.py file, set administration_port_enabled to true, verify the admin sever pod is running and ready and all managed server pods are created |
61+
| Domain on PV using WLST | in create domain input file, set exposeAdminT3Channel to true, verify the admin t3 channel is exposed |

integration-tests/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Shared cluster runs only Quick test use cases, Jenkins runs both Quick and Full
1616

1717
Use Cases covered in integration tests for the operator is available [here](USECASES.MD)
1818

19+
JRF Use Cases are covered [here](JRFUSECASES.MD)
20+
1921
# Directory Configuration and Structure
2022

2123
Directory structure of source code:
@@ -282,6 +284,35 @@ Failed run will have the output like
282284
```
283285
JUnit test results can be seen at "integration-tests/target/failsafe-reports/TEST-oracle.kubernetes.operator.ITOperator.xml". This file shows how much time each test case took to run and the failed test results if any.
284286

287+
# How to run JRF domain In Operator related tests
288+
* Setup docker access to FMW Infrastructure 12c Image and Oracle Database 12c Image
289+
290+
Method 1
291+
- Setup a personal account on hub.docker.com
292+
- Then sign in to hub.docker.com and signup for access to Oracle Database 12c Images via https://hub.docker.com/_/oracle-database-enterprise-edition
293+
- Then export the following before running the tests:
294+
```
295+
export DOCKER_USERNAME=<docker_username>
296+
export DOCKER_PASSWORD=<docker_password>
297+
export DOCKER_EMAIL=<docker_email>
298+
```
299+
- Setup an account in phx.ocir.io
300+
- Then sign in to phx.ocir.io to get access to FMW Infrastructure 12c Image: **_phx.ocir.io/weblogick8s/oracle/fmw-infrastructure:12.2.1.3_**
301+
- export the following before running the tests:
302+
```
303+
export REPO_USERNAME=<ocir_username>
304+
export REPO_PASSWORD=<ocir_password>
305+
export REPO_EMAIL=<ocir_email>
306+
```
307+
308+
Method 2
309+
- Make sure the FMW Infrastructure image i.e. **_phx.ocir.io/weblogick8s/oracle/fmw-infrastructure:12.2.1.3_** and the Oracle database image i.e. **_store/oracle/database-enterprise:12.2.0.1_** already exist locally in a docker repository the k8s cluster can access
310+
311+
* Command to run the tests:
312+
```
313+
mvn clean verify -P jrf-integration-tests 2>&1 | tee log.txt
314+
```
315+
285316
# How to run a single test
286317
287318
mvn -Dit.test="ITOperator#testDomainOnPVUsingWLST" -DfailIfNoTests=false integration-test -P java-integration-tests

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

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,190 @@ public void testTwoJRFDomainsManagedByTwoOperators() throws Exception {
230230
logger.info("SUCCESS - " + testMethodName);
231231
}
232232

233+
/**
234+
* create two JRF domains in the same namespace and managed by one operator. Verify scaling up and
235+
* down for domain1 cluster will have no impact on domain2. Cycle domain2 down and back up, verify
236+
* there is no impact on domain1. shutdown by the domains using the delete resource script from
237+
* samples.
238+
*
239+
* @throws Exception - if any error occurs
240+
*/
241+
@Test
242+
public void testTwoJRFDomainsManagedByOneOperatorInSameNS() throws Exception {
243+
Assume.assumeFalse(QUICKTEST);
244+
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
245+
logTestBegin(testMethodName);
246+
247+
logger.info("Checking if operator1 and domain1 are running, if not creating");
248+
if (operator1 == null) {
249+
operator1 = TestUtils.createOperator(JRF_OPERATOR_FILE_1);
250+
}
251+
252+
JRFDomain domain1 = null, domain2 = null;
253+
boolean testCompletedSuccessfully = false;
254+
try {
255+
// load input yaml to map and add configOverrides
256+
Map<String, Object> domain1Map = TestUtils.loadYaml(JRF_DOMAIN_ON_PV_WLST_FILE);
257+
domain1Map.put("domainUID", "jrfd1");
258+
domain1Map.put("adminNodePort", 30705);
259+
domain1Map.put("t3ChannelPort", 30025);
260+
domain1Map.put("voyagerWebPort", 30309);
261+
domain1Map.put("rcuSchemaPrefix", "jrfd1");
262+
263+
// run RCU script to load db schema
264+
DBUtils.runRCU(rcuPodName, domain1Map);
265+
266+
Map<String, Object> domain2Map = TestUtils.loadYaml(JRF_DOMAIN_ON_PV_WLST_FILE);
267+
domain2Map.put("domainUID", "jrfd2");
268+
domain2Map.put("adminNodePort", 30706);
269+
domain2Map.put("t3ChannelPort", 30026);
270+
domain2Map.put("voyagerWebPort", 30310);
271+
domain2Map.put("rcuSchemaPrefix", "jrfd2");
272+
273+
// run RCU script to load db schema
274+
DBUtils.runRCU(rcuPodName, domain2Map);
275+
276+
// create domain1
277+
logger.info("Creating Domain domain1 & verifying the domain creation");
278+
domain1 = new JRFDomain(domain1Map);
279+
domain1.verifyDomainCreated();
280+
281+
testBasicUseCases(domain1);
282+
283+
// create domain2
284+
domain2 = new JRFDomain(domain2Map);
285+
domain2.verifyDomainCreated();
286+
287+
testBasicUseCases(domain2);
288+
289+
logger.info("Verify the running domain domain1 is unaffected");
290+
domain1.verifyDomainCreated();
291+
292+
testClusterScaling(operator1, domain1);
293+
294+
logger.info("Verify the running domain domain2 is unaffected");
295+
domain2.verifyDomainCreated();
296+
297+
logger.info("Destroy and create domain2 and verify no impact on domain1");
298+
domain2.destroy();
299+
domain2.create();
300+
301+
logger.info("Verify no impact on domain1");
302+
domain1.verifyDomainCreated();
303+
testCompletedSuccessfully = true;
304+
305+
} finally {
306+
String domainUidsToBeDeleted = "";
307+
308+
if (domain1 != null && (JENKINS || testCompletedSuccessfully)) {
309+
domainUidsToBeDeleted = domain1.getDomainUid();
310+
}
311+
if (domain2 != null && (JENKINS || testCompletedSuccessfully)) {
312+
domainUidsToBeDeleted = domainUidsToBeDeleted + "," + domain2.getDomainUid();
313+
}
314+
if (!domainUidsToBeDeleted.equals("")) {
315+
logger.info("About to delete domains: " + domainUidsToBeDeleted);
316+
TestUtils.deleteWeblogicDomainResources(domainUidsToBeDeleted);
317+
TestUtils.verifyAfterDeletion(domain1);
318+
TestUtils.verifyAfterDeletion(domain2);
319+
}
320+
}
321+
logger.info("SUCCESS - " + testMethodName);
322+
}
323+
324+
/**
325+
* create two JRF domains in the different namespaces and managed by one operator. Domain1 uses
326+
* Voyager load balancer, Domain2 uses Traefik load balancer. Verify scaling up and down for
327+
* domain1 cluster will have no impact on domain2. Cycle domain2 down and back up, verify there is
328+
* no impact on domain1. shutdown by the domains using the delete resource script from samples.
329+
*
330+
* @throws Exception - if any error occurs
331+
*/
332+
@Test
333+
public void testTwoJRFDomainsManagedByOneOperatorInDifferentNS() throws Exception {
334+
Assume.assumeFalse(QUICKTEST);
335+
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
336+
logTestBegin(testMethodName);
337+
338+
logger.info("Checking if operator1 and domain1 are running, if not creating");
339+
if (operator1 == null) {
340+
operator1 = TestUtils.createOperator(JRF_OPERATOR_FILE_1);
341+
}
342+
343+
JRFDomain domain1 = null, domain2 = null;
344+
boolean testCompletedSuccessfully = false;
345+
try {
346+
// load input yaml to map and add configOverrides
347+
Map<String, Object> domain1Map = TestUtils.loadYaml(JRF_DOMAIN_ON_PV_WLST_FILE);
348+
domain1Map.put("domainUID", "jrfd11");
349+
domain1Map.put("adminNodePort", 30707);
350+
domain1Map.put("t3ChannelPort", 30027);
351+
domain1Map.put("voyagerWebPort", 30311);
352+
domain1Map.put("rcuSchemaPrefix", "jrfd11");
353+
domain1Map.put("namespace", "default");
354+
domain1Map.put("loadBalancer", "VOYAGER");
355+
356+
// run RCU script to load db schema
357+
DBUtils.runRCU(rcuPodName, domain1Map);
358+
359+
Map<String, Object> domain2Map = TestUtils.loadYaml(JRF_DOMAIN_ON_PV_WLST_FILE);
360+
domain2Map.put("domainUID", "jrfd21");
361+
domain2Map.put("adminNodePort", 30708);
362+
domain2Map.put("t3ChannelPort", 30028);
363+
domain2Map.put("voyagerWebPort", 30312);
364+
domain2Map.put("rcuSchemaPrefix", "jrfd21");
365+
366+
// run RCU script to load db schema
367+
DBUtils.runRCU(rcuPodName, domain2Map);
368+
369+
// create domain1
370+
logger.info("Creating Domain domain1 & verifying the domain creation");
371+
domain1 = new JRFDomain(domain1Map);
372+
domain1.verifyDomainCreated();
373+
374+
testBasicUseCases(domain1);
375+
376+
// create domain2
377+
domain2 = new JRFDomain(domain2Map);
378+
domain2.verifyDomainCreated();
379+
380+
testBasicUseCases(domain2);
381+
382+
logger.info("Verify the running domain domain1 is unaffected");
383+
domain1.verifyDomainCreated();
384+
385+
testClusterScaling(operator1, domain1);
386+
387+
logger.info("Verify the running domain domain2 is unaffected");
388+
domain2.verifyDomainCreated();
389+
390+
logger.info("Destroy and create domain2 and verify no impact on domain1");
391+
domain2.destroy();
392+
domain2.create();
393+
394+
logger.info("Verify no impact on domain1");
395+
domain1.verifyDomainCreated();
396+
testCompletedSuccessfully = true;
397+
398+
} finally {
399+
String domainUidsToBeDeleted = "";
400+
401+
if (domain1 != null && (JENKINS || testCompletedSuccessfully)) {
402+
domainUidsToBeDeleted = domain1.getDomainUid();
403+
}
404+
if (domain2 != null && (JENKINS || testCompletedSuccessfully)) {
405+
domainUidsToBeDeleted = domainUidsToBeDeleted + "," + domain2.getDomainUid();
406+
}
407+
if (!domainUidsToBeDeleted.equals("")) {
408+
logger.info("About to delete domains: " + domainUidsToBeDeleted);
409+
TestUtils.deleteWeblogicDomainResources(domainUidsToBeDeleted);
410+
TestUtils.verifyAfterDeletion(domain1);
411+
TestUtils.verifyAfterDeletion(domain2);
412+
}
413+
}
414+
logger.info("SUCCESS - " + testMethodName);
415+
}
416+
233417
/**
234418
* Create operator if its not running and create domain with serverStartPolicy="ADMIN_ONLY".
235419
* Verify only admin server is created. shutdown by deleting domain CRD. Create domain on existing

0 commit comments

Comments
 (0)