Skip to content

Commit 2f49e81

Browse files
committed
Subclass tests and call in different domains
1 parent cf60bd0 commit 2f49e81

File tree

3 files changed

+167
-34
lines changed

3 files changed

+167
-34
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import org.junit.Test;
1010

1111
/** JUnit test class used for testing configuration override use cases. */
12-
public class ItSitConfigDomainInImage extends ItSitConfig {
12+
public class ItSitConfigDomainInImage extends SitConfig {
1313

1414
/**
1515
* This method gets called only once before any of the test methods are executed. It does the
@@ -21,7 +21,7 @@ public class ItSitConfigDomainInImage extends ItSitConfig {
2121
*/
2222
@BeforeClass
2323
public static void staticPrepare() throws Exception {
24-
prepare(
24+
SitConfig.staticPrepare(
2525
"integration-tests/src/test/resources/sitconfig/scripts/create-domain-auto-custom-sit-config-inimage.py");
2626
}
2727

@@ -32,7 +32,7 @@ public static void staticPrepare() throws Exception {
3232
*/
3333
@AfterClass
3434
public static void staticUnPrepare() throws Exception {
35-
ItSitConfig.staticUnPrepare();
35+
SitConfig.staticUnPrepare();
3636
}
3737

3838
/**
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at
3+
// http://oss.oracle.com/licenses/upl.
4+
package oracle.kubernetes.operator;
5+
6+
import org.junit.AfterClass;
7+
import org.junit.BeforeClass;
8+
import org.junit.Test;
9+
10+
/** JUnit test class used for testing configuration override use cases. */
11+
public class ItSitConfigDomainInPV extends SitConfig {
12+
13+
/**
14+
* This method gets called only once before any of the test methods are executed. It does the
15+
* initialization of the integration test properties defined in OperatorIT.properties and setting
16+
* the resultRoot, pvRoot and projectRoot attributes.
17+
*
18+
* @throws Exception when the initialization, creating directories , copying files and domain
19+
* creation fails.
20+
*/
21+
@BeforeClass
22+
public static void staticPrepare() throws Exception {
23+
SitConfig.staticPrepare(
24+
"integration-tests/src/test/resources/sitconfig/scripts/create-domain-auto-custom-sit-config20.py");
25+
}
26+
27+
/**
28+
* Destroy domain, delete the MySQL DB container and teardown.
29+
*
30+
* @throws Exception when domain destruction or MySQL container destruction fails
31+
*/
32+
@AfterClass
33+
public static void staticUnPrepare() throws Exception {
34+
SitConfig.staticUnPrepare();
35+
}
36+
37+
/**
38+
* This test covers custom configuration override use cases for config.xml for administration
39+
* server.
40+
*
41+
* <p>The test checks the overridden config.xml attributes connect-timeout, max-message-size,
42+
* restart-max, JMXCore and ServerLifeCycle debug flags, the T3Channel public address. The
43+
* overridden values are verified against the ServerConfig MBean tree. It does not verifies
44+
* whether the overridden values are applied to the runtime.
45+
*
46+
* @throws Exception when the assertion fails due to unmatched values
47+
*/
48+
@Test
49+
public void testCustomSitConfigOverridesForDomainInPV() throws Exception {
50+
testCustomSitConfigOverridesForDomain();
51+
}
52+
53+
/**
54+
* This test covers custom configuration override use cases for config.xml for managed server.
55+
*
56+
* <p>The test checks the overridden config.xml server template attribute max-message-size. The
57+
* overridden values are verified against the ServerConfig MBean tree. It does not verifies
58+
* whether the overridden values are applied to the runtime.
59+
*
60+
* @throws Exception when the assertion fails due to unmatched values
61+
*/
62+
@Test
63+
public void testCustomSitConfigOverridesForDomainMSInPV() throws Exception {
64+
testCustomSitConfigOverridesForDomainMS();
65+
}
66+
67+
/**
68+
* This test covers custom resource override use cases for JDBC resource.
69+
*
70+
* <p>The resource override sets the following connection pool properties. initialCapacity,
71+
* maxCapacity, test-connections-on-reserve, connection-harvest-max-count,
72+
* inactive-connection-timeout-seconds in the JDBC resource override file. It also overrides the
73+
* jdbc driver parameters like data source url, db user and password using kubernetes secret.
74+
*
75+
* <p>The overridden values are verified against the ServerConfig MBean tree. It does not verifies
76+
* whether the overridden values are applied to the runtime except the JDBC URL which is verified
77+
* at runtime by making a connection to the MySql database and executing a DDL statement.
78+
*
79+
* @throws Exception when the assertion fails due to unmatched values
80+
*/
81+
@Test
82+
public void testCustomSitConfigOverridesForJdbcInPV() throws Exception {
83+
testCustomSitConfigOverridesForJdbc();
84+
}
85+
86+
/**
87+
* This test covers custom resource use cases for JMS resource. The JMS resource override file
88+
* sets the following Delivery Failure Parameters re delivery limit and expiration policy for a
89+
* uniform-distributed-topic JMS resource.
90+
*
91+
* <p>The overridden values are verified against the ServerConfig MBean tree. It does not verifies
92+
* whether the overridden values are applied to the runtime.
93+
*
94+
* @throws Exception when the assertion fails due to unmatched values
95+
*/
96+
@Test
97+
public void testCustomSitConfigOverridesForJmsInPV() throws Exception {
98+
testCustomSitConfigOverridesForJms();
99+
}
100+
101+
/**
102+
* This test covers custom resource override use cases for diagnostics resource. It adds the
103+
* following instrumentation monitors. Connector_After_Inbound, Connector_Around_Outbound,
104+
* Connector_Around_Tx, Connector_Around_Work, Connector_Before_Inbound, and harvesters for
105+
* weblogic.management.runtime.JDBCServiceRuntimeMBean,
106+
* weblogic.management.runtime.ServerRuntimeMBean.
107+
*
108+
* <p>The overridden values are verified against the ServerConfig MBean tree. It does not verifies
109+
* whether the overridden values are applied to the runtime.
110+
*
111+
* @throws Exception when the assertion fails due to unmatched values
112+
*/
113+
@Test
114+
public void testCustomSitConfigOverridesForWldfInPV() throws Exception {
115+
testCustomSitConfigOverridesForWldf();
116+
}
117+
118+
/**
119+
* Test to verify the configuration override after a domain is up and running. Modifies the
120+
* existing config.xml entries to add startup and shutdown classes verifies those are overridden
121+
* when domain is restarted.
122+
*
123+
* @throws Exception when assertions fail.
124+
*/
125+
@Test
126+
public void testConfigOverrideAfterDomainStartupInPV() throws Exception {
127+
testConfigOverrideAfterDomainStartup();
128+
}
129+
130+
/**
131+
* This test covers the overriding of JDBC system resource after a domain is up and running. It
132+
* creates a datasource , recreates the K8S configmap with updated JDBC descriptor and verifies
133+
* the new overridden values with restart of the WLS pods
134+
*
135+
* @throws Exception when assertions fail.
136+
*/
137+
@Test
138+
public void testOverrideJdbcResourceAfterDomainStartInPV() throws Exception {
139+
testOverrideJdbcResourceAfterDomainStart();
140+
}
141+
142+
/**
143+
* This test covers the overriding of JDBC system resource with new kubernetes secret name for
144+
* dbusername and dbpassword.
145+
*
146+
* @throws Exception when assertions fail.
147+
*/
148+
@Test
149+
public void testOverrideJdbcResourceWithNewSecretInPV() throws Exception {
150+
testOverrideJdbcResourceWithNewSecret();
151+
}
152+
}

integration-tests/src/test/java/oracle/kubernetes/operator/ItSitConfig.java renamed to integration-tests/src/test/java/oracle/kubernetes/operator/SitConfig.java

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
4-
54
package oracle.kubernetes.operator;
65

76
import java.io.IOException;
@@ -18,14 +17,11 @@
1817
import oracle.kubernetes.operator.utils.ExecResult;
1918
import oracle.kubernetes.operator.utils.Operator;
2019
import oracle.kubernetes.operator.utils.TestUtils;
21-
import org.junit.AfterClass;
2220
import org.junit.Assert;
2321
import org.junit.Assume;
24-
import org.junit.BeforeClass;
25-
import org.junit.Test;
2622

2723
/** JUnit test class used for testing configuration override use cases. */
28-
public class ItSitConfig extends BaseTest {
24+
public class SitConfig extends BaseTest {
2925

3026
private static final String DOMAINUID = "customsitconfigdomain";
3127
private static final String ADMINPORT = "30710";
@@ -56,13 +52,7 @@ public class ItSitConfig extends BaseTest {
5652
* @throws Exception when the initialization, creating directories , copying files and domain
5753
* creation fails.
5854
*/
59-
@BeforeClass
60-
public static void staticPrepare() throws Exception {
61-
prepare(
62-
"integration-tests/src/test/resources/sitconfig/scripts/create-domain-auto-custom-sit-config20.py");
63-
}
64-
65-
public static void prepare(String domainScript) throws Exception {
55+
protected static void staticPrepare(String domainScript) throws Exception {
6656
// initialize test properties and create the directories
6757
if (!QUICKTEST) {
6858
// initialize test properties and create the directories
@@ -125,8 +115,7 @@ public static void prepare(String domainScript) throws Exception {
125115
*
126116
* @throws Exception when domain destruction or MySQL container destruction fails
127117
*/
128-
@AfterClass
129-
public static void staticUnPrepare() throws Exception {
118+
protected static void staticUnPrepare() throws Exception {
130119
if (!QUICKTEST) {
131120
ExecResult result = TestUtils.exec("kubectl delete -f " + mysqlYamlFile);
132121
destroySitConfigDomain();
@@ -142,7 +131,7 @@ public static void staticUnPrepare() throws Exception {
142131
* @return - created domain
143132
* @throws Exception - if it cannot create the domain
144133
*/
145-
protected static Domain createSitConfigDomain(String domainScript) throws Exception {
134+
private static Domain createSitConfigDomain(String domainScript) throws Exception {
146135
// load input yaml to map and add configOverrides
147136
Map<String, Object> domainMap = TestUtils.loadYaml(DOMAININIMAGE_WLST_YAML);
148137
domainMap.put("configOverrides", "sitconfigcm");
@@ -224,8 +213,7 @@ private static void copyMySqlFile() throws IOException {
224213
*
225214
* @throws Exception when the assertion fails due to unmatched values
226215
*/
227-
@Test
228-
public void testCustomSitConfigOverridesForDomain() throws Exception {
216+
protected void testCustomSitConfigOverridesForDomain() throws Exception {
229217
Assume.assumeFalse(QUICKTEST);
230218
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
231219
logTestBegin(testMethod);
@@ -253,8 +241,7 @@ public void testCustomSitConfigOverridesForDomain() throws Exception {
253241
*
254242
* @throws Exception when the assertion fails due to unmatched values
255243
*/
256-
@Test
257-
public void testCustomSitConfigOverridesForDomainMS() throws Exception {
244+
protected void testCustomSitConfigOverridesForDomainMS() throws Exception {
258245
Assume.assumeFalse(QUICKTEST);
259246
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
260247
logTestBegin(testMethod);
@@ -287,8 +274,7 @@ public void testCustomSitConfigOverridesForDomainMS() throws Exception {
287274
*
288275
* @throws Exception when the assertion fails due to unmatched values
289276
*/
290-
@Test
291-
public void testCustomSitConfigOverridesForJdbc() throws Exception {
277+
protected void testCustomSitConfigOverridesForJdbc() throws Exception {
292278
Assume.assumeFalse(QUICKTEST);
293279
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
294280
logTestBegin(testMethod);
@@ -319,8 +305,7 @@ public void testCustomSitConfigOverridesForJdbc() throws Exception {
319305
*
320306
* @throws Exception when the assertion fails due to unmatched values
321307
*/
322-
@Test
323-
public void testCustomSitConfigOverridesForJms() throws Exception {
308+
protected void testCustomSitConfigOverridesForJms() throws Exception {
324309
Assume.assumeFalse(QUICKTEST);
325310
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
326311
logTestBegin(testMethod);
@@ -351,8 +336,7 @@ public void testCustomSitConfigOverridesForJms() throws Exception {
351336
*
352337
* @throws Exception when the assertion fails due to unmatched values
353338
*/
354-
@Test
355-
public void testCustomSitConfigOverridesForWldf() throws Exception {
339+
protected void testCustomSitConfigOverridesForWldf() throws Exception {
356340
Assume.assumeFalse(QUICKTEST);
357341
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
358342
logTestBegin(testMethod);
@@ -378,8 +362,7 @@ public void testCustomSitConfigOverridesForWldf() throws Exception {
378362
*
379363
* @throws Exception when assertions fail.
380364
*/
381-
@Test
382-
public void testConfigOverrideAfterDomainStartup() throws Exception {
365+
protected void testConfigOverrideAfterDomainStartup() throws Exception {
383366
Assume.assumeFalse(QUICKTEST);
384367
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
385368
logTestBegin(testMethod);
@@ -413,8 +396,7 @@ public void testConfigOverrideAfterDomainStartup() throws Exception {
413396
*
414397
* @throws Exception when assertions fail.
415398
*/
416-
@Test
417-
public void testOverrideJdbcResourceAfterDomainStart() throws Exception {
399+
protected void testOverrideJdbcResourceAfterDomainStart() throws Exception {
418400
Assume.assumeFalse(QUICKTEST);
419401
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
420402
logTestBegin(testMethod);
@@ -448,8 +430,7 @@ public void testOverrideJdbcResourceAfterDomainStart() throws Exception {
448430
*
449431
* @throws Exception when assertions fail.
450432
*/
451-
@Test
452-
public void testOverrideJdbcResourceWithNewSecret() throws Exception {
433+
protected void testOverrideJdbcResourceWithNewSecret() throws Exception {
453434
Assume.assumeFalse(QUICKTEST);
454435
String testMethod = new Object() {}.getClass().getEnclosingMethod().getName();
455436
logTestBegin(testMethod);

0 commit comments

Comments
 (0)