Skip to content

Commit 0a3df4a

Browse files
authored
Merge branch 'develop' into exportertest
2 parents bc16439 + af4835d commit 0a3df4a

35 files changed

+1208
-276
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: 44 additions & 1 deletion
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:
@@ -226,8 +228,20 @@ SHARED_CLUSTER=true:
226228
| IMAGE_NAME_OPERATOR | Docker image name for operator. Default is weblogic-kubernetes-operator |
227229
| IMAGE_PULL_POLICY_OPERATOR | Default 'Never'. |
228230
| IMAGE_PULL_SECRET_OPERATOR | Default ''. |
229-
| IMAGE_PULL_SECRET_WEBLOGIC | Default ''.
231+
| IMAGE_PULL_SECRET_WEBLOGIC | Default ''. |
230232

233+
The below env variables are required for SHARED_CLUSTER=true:
234+
235+
| Variable | Description |
236+
| --- | --- |
237+
| REPO_REGISTRY | OCIR Server to push/pull the Operator image |
238+
| REPO_USERNAME | OCIR Username |
239+
| REPO_PASSWORD | OCIR token |
240+
| REPO_EMAIL | OCIR email |
241+
| DOCKER_USERNAME | Docker username to pull the Weblogic image |
242+
| DOCKER_PASSWORD | Docker password |
243+
| DOCKER_EMAIL | Docker email |
244+
| K8S_NODEPORT_HOST | DNS name of a Kubernetes worker node. |
231245

232246
Successful run will have the output like below:
233247
```
@@ -282,6 +296,35 @@ Failed run will have the output like
282296
```
283297
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.
284298

299+
# How to run JRF domain In Operator related tests
300+
* Setup docker access to FMW Infrastructure 12c Image and Oracle Database 12c Image
301+
302+
Method 1
303+
- Setup a personal account on hub.docker.com
304+
- 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
305+
- Then export the following before running the tests:
306+
```
307+
export DOCKER_USERNAME=<docker_username>
308+
export DOCKER_PASSWORD=<docker_password>
309+
export DOCKER_EMAIL=<docker_email>
310+
```
311+
- Setup an account in phx.ocir.io
312+
- 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_**
313+
- export the following before running the tests:
314+
```
315+
export REPO_USERNAME=<ocir_username>
316+
export REPO_PASSWORD=<ocir_password>
317+
export REPO_EMAIL=<ocir_email>
318+
```
319+
320+
Method 2
321+
- 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
322+
323+
* Command to run the tests:
324+
```
325+
mvn clean verify -P jrf-integration-tests 2>&1 | tee log.txt
326+
```
327+
285328
# How to run a single test
286329
287330
mvn -Dit.test="ITOperator#testDomainOnPVUsingWLST" -DfailIfNoTests=false integration-test -P java-integration-tests

integration-tests/USECASES.MD

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,10 @@ Configuration Overrides Usecases
114114
| Replace/Append Configuration with config file written in non yml format via exporter console| Try to replace/append monitoring exporter configuration with config file written in non yml format, verify configuration has not changed |
115115
| Replace/Append Configuration with corrupted yml file via exporter console| Try to replace/append monitoring exporter configuration with config file written in corrupted yml format, verify configuration has not changed |
116116
| Replace/Append Configuration with dublicated values in the config file via exporter console| Try to replace/append monitoring exporter configuration with dublicated values in the config file, verify configuration has not changed |
117-
| Replace/Append Configuration with invalid credentials via exporter console| Try to replace/append monitoring exporter configuration with varios combos for invalid credentials, verify configuration has not changed and `401 Unauthorized` exception was thrown |
117+
| Replace/Append Configuration with invalid credentials via exporter console| Try to replace/append monitoring exporter configuration with varios combos for invalid credentials, verify configuration has not changed and `401 Unauthorized` exception was thrown |
118+
119+
| Logging with Elastic Stack | Use Case |
120+
| --- | --- |
121+
| Search log level | Use Elasticsearch Count API to query logs of level=INFO and verify that total number of logs for level=INFO is not zero and failed count is zero |
122+
| Search Operator log | Use Elasticsearch Search APIs to query Operator log info and verify that log hits for type=weblogic-operator are not empty |
123+
| Search Weblogic log | Use Elasticsearch Search APIs to query Weblogic log info and verify that log hits for Weblogic servers are not empty |

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

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class BaseTest {
3535
public static final String OPERATOR2_YAML = "operator2.yaml";
3636
public static final String OPERATORBC_YAML = "operator_bc.yaml";
3737
public static final String OPERATOR_CHAIN_YAML = "operator_chain.yaml";
38+
public static final String OPERATOR1_ELK_YAML = "operator_elk.yaml";
3839

3940
// file used to customize domain properties for domain, PV and LB inputs yaml
4041
public static final String DOMAINONPV_WLST_YAML = "domainonpvwlst.yaml";
@@ -51,6 +52,7 @@ public class BaseTest {
5152
public static boolean QUICKTEST;
5253
public static boolean SMOKETEST;
5354
public static boolean JENKINS;
55+
public static boolean SHARED_CLUSTER;
5456
public static boolean INGRESSPERDOMAIN = true;
5557

5658
private static String resultRoot = "";
@@ -82,6 +84,9 @@ public class BaseTest {
8284
if (System.getenv("JENKINS") != null) {
8385
JENKINS = new Boolean(System.getenv("JENKINS")).booleanValue();
8486
}
87+
if (System.getenv("SHARED_CLUSTER") != null) {
88+
SHARED_CLUSTER = new Boolean(System.getenv("SHARED_CLUSTER")).booleanValue();
89+
}
8590
if (System.getenv("INGRESSPERDOMAIN") != null) {
8691
INGRESSPERDOMAIN = new Boolean(System.getenv("INGRESSPERDOMAIN")).booleanValue();
8792
}
@@ -127,7 +132,7 @@ public static void initialize(String appPropsFile) throws Exception {
127132
}
128133

129134
// for manual/local run, do cleanup
130-
if (System.getenv("SHARED_CLUSTER") == null && System.getenv("JENKINS") == null) {
135+
if (!JENKINS) {
131136

132137
// delete k8s artifacts created if any, delete PV directories
133138
ExecResult clnResult = cleanup();
@@ -142,19 +147,25 @@ public static void initialize(String appPropsFile) throws Exception {
142147
+ clnResult.stderr());
143148
}
144149

145-
if (System.getenv("JENKINS") != null) {
146-
logger.info("Creating " + resultRoot + "/acceptance_test_tmp");
150+
if (JENKINS) {
151+
logger.info("Deleting and creating " + resultRoot + "/acceptance_test_tmp");
147152
TestUtils.exec(
148-
"/usr/local/packages/aime/ias/run_as_root \"mkdir -p "
153+
"/usr/local/packages/aime/ias/run_as_root \"rm -rf "
154+
+ resultRoot
155+
+ "/acceptance_test_tmp\" && "
156+
+ "/usr/local/packages/aime/ias/run_as_root \"mkdir -p "
149157
+ resultRoot
150158
+ "/acceptance_test_tmp\"");
151159
TestUtils.exec(
152160
"/usr/local/packages/aime/ias/run_as_root \"chmod 777 "
153161
+ resultRoot
154162
+ "/acceptance_test_tmp\"");
155-
logger.info("Creating " + pvRoot + "/acceptance_test_pv");
163+
logger.info("Deleting and Creating " + pvRoot + "/acceptance_test_pv");
156164
TestUtils.exec(
157-
"/usr/local/packages/aime/ias/run_as_root \"mkdir -p "
165+
"/usr/local/packages/aime/ias/run_as_root \"rm -rf "
166+
+ pvRoot
167+
+ "/acceptance_test_pv\" && "
168+
+ "/usr/local/packages/aime/ias/run_as_root \"mkdir -p "
158169
+ pvRoot
159170
+ "/acceptance_test_pv\"");
160171
TestUtils.exec(
@@ -176,7 +187,7 @@ public static void initialize(String appPropsFile) throws Exception {
176187
logger.info("Adding file handler, logging to file at " + resultDir + "/java_test_suite.out");
177188

178189
// for manual/local run, create file handler, create PVROOT
179-
if (System.getenv("SHARED_CLUSTER") == null && System.getenv("JENKINS") == null) {
190+
if (!JENKINS && !SHARED_CLUSTER) {
180191
logger.info("Creating PVROOT " + pvRoot);
181192
Files.createDirectories(Paths.get(pvRoot));
182193
ExecResult result = ExecCommand.exec("chmod 777 " + pvRoot);
@@ -210,6 +221,9 @@ public static void initialize(String appPropsFile) throws Exception {
210221
"Env var IMAGE_PULL_SECRET_OPERATOR " + System.getenv("IMAGE_PULL_SECRET_OPERATOR"));
211222
logger.info(
212223
"Env var IMAGE_PULL_SECRET_WEBLOGIC " + System.getenv("IMAGE_PULL_SECRET_WEBLOGIC"));
224+
logger.info("Env var IMAGE_NAME_WEBLOGIC " + System.getenv("IMAGE_NAME_WEBLOGIC"));
225+
logger.info("Env var IMAGE_TAG_WEBLOGIC " + System.getenv("IMAGE_TAG_WEBLOGIC"));
226+
213227
logger.info("Env var BRANCH_NAME " + System.getenv("BRANCH_NAME"));
214228
}
215229

@@ -530,7 +544,7 @@ public static ExecResult cleanup() throws Exception {
530544
+ getResultRoot()
531545
+ " export PV_ROOT="
532546
+ getPvRoot()
533-
+ " && "
547+
+ " export SHARED_CLUSTER=false && "
534548
+ getProjectRoot()
535549
+ "/src/integration-tests/bash/cleanup.sh";
536550
logger.info("Command to call cleanup script " + cmd);
@@ -671,11 +685,8 @@ public static void tearDown(String iTClassName) throws Exception {
671685
StringBuffer cmd =
672686
new StringBuffer(
673687
"export RESULT_ROOT=$RESULT_ROOT && export PV_ROOT=$PV_ROOT && export IT_CLASS=");
674-
cmd.append(iTClassName);
675-
if (JENKINS) {
676-
cmd.append(" && export JENKINS_RESULTS_DIR=${WORKSPACE}/logdir/${BUILD_TAG} ");
677-
}
678-
cmd.append(" && ")
688+
cmd.append(iTClassName)
689+
.append(" && export JENKINS_RESULTS_DIR=${WORKSPACE}/logdir/${BUILD_TAG} && ")
679690
.append(BaseTest.getProjectRoot())
680691
.append("/integration-tests/src/test/resources/statedump.sh");
681692
logger.info("Running " + cmd);
@@ -692,7 +703,7 @@ public static void tearDown(String iTClassName) throws Exception {
692703

693704
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
694705

695-
if (JENKINS) {
706+
if (JENKINS || SHARED_CLUSTER) {
696707
result = cleanup();
697708
if (result.exitValue() != 0) {
698709
logger.info("cleanup result =" + result.stdout() + "\n " + result.stderr());

0 commit comments

Comments
 (0)