Skip to content

Commit de07935

Browse files
author
Vince Kraemer
committed
Merge commit '98d5034' into service_label_and_annotation
2 parents b60b3e6 + 98d5034 commit de07935

File tree

70 files changed

+2519
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2519
-443
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/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@
6666
<artifactId>snakeyaml</artifactId>
6767
<version>1.21</version>
6868
</dependency>
69-
</dependencies>
69+
<dependency>
70+
<groupId>io.kubernetes</groupId>
71+
<artifactId>client-java</artifactId>
72+
<scope>test</scope>
73+
</dependency>
74+
</dependencies>
7075

7176

7277
<profiles>

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

Lines changed: 126 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class ITOperator extends BaseTest {
2828
// property file used to customize operator properties for operator inputs yaml
2929
private static String op1YamlFile = "operator1.yaml";
3030
private static String op2YamlFile = "operator2.yaml";
31+
private static final String opForDelYamlFile1 = "operator_del1.yaml";
32+
private static final String opForDelYamlFile2 = "operator_del2.yaml";
3133

3234
// property file used to customize domain properties for domain inputs yaml
3335
private static String domain1YamlFile = "domain1.yaml";
@@ -38,12 +40,33 @@ public class ITOperator extends BaseTest {
3840
private static String domain6YamlFile = "domain6.yaml";
3941
private static String domain7YamlFile = "domain7.yaml";
4042
private static String domain8YamlFile = "domain8.yaml";
43+
private static final String domain1ForDelValueYamlFile = "domain_del_1.yaml";
44+
private static final String domain2ForDelValueYamlFile = "domain_del_2.yaml";
45+
private static final String domain3ForDelValueYamlFile = "domain_del_3.yaml";
46+
private static String domain9YamlFile = "domain9.yaml";
47+
private static String domain10YamlFile = "domain10.yaml";
4148

4249
// property file used to configure constants for integration tests
4350
private static String appPropsFile = "OperatorIT.properties";
4451

4552
private static Operator operator1, operator2;
46-
private static Domain domain1;
53+
54+
private static Operator operatorForDel1;
55+
private static Operator operatorForDel2;
56+
57+
private static boolean QUICKTEST;
58+
private static boolean SMOKETEST;
59+
60+
// Set QUICKTEST env var to true to run a small subset of tests.
61+
// Set SMOKETEST env var to true to run an even smaller subset
62+
// of tests, plus leave domain1 up and running when the test completes.
63+
static {
64+
QUICKTEST =
65+
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true");
66+
SMOKETEST =
67+
System.getenv("SMOKETEST") != null && System.getenv("SMOKETEST").equalsIgnoreCase("true");
68+
if (SMOKETEST) QUICKTEST = true;
69+
}
4770

4871
/**
4972
* This method gets called only once before any of the test methods are executed. It does the
@@ -93,17 +116,16 @@ public void test1CreateFirstOperatorAndDomain() throws Exception {
93116

94117
logTestBegin("test1CreateFirstOperatorAndDomain");
95118
testCreateOperatorManagingDefaultAndTest1NS();
96-
domain1 = testAllUseCasesForADomain(operator1, domain1YamlFile);
97-
domain1.testWlsLivenessProbe();
98-
domain1.destroy();
119+
Domain domain1 = testAllUseCasesForADomain(operator1, domain1YamlFile);
120+
if (!SMOKETEST) domain1.testWlsLivenessProbe();
121+
if (!SMOKETEST) domain1.shutdownUsingServerStartPolicy();
99122

100123
logger.info("SUCCESS - test1CreateFirstOperatorAndDomain");
101124
}
102125

103126
@Test
104127
public void test2CreateAnotherDomainInDefaultNS() throws Exception {
105-
Assume.assumeFalse(
106-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
128+
Assume.assumeFalse(QUICKTEST);
107129

108130
logTestBegin("test2CreateAnotherDomainInDefaultNS");
109131
logger.info("Creating Domain domain2 & verifing the domain creation");
@@ -120,8 +142,7 @@ public void test2CreateAnotherDomainInDefaultNS() throws Exception {
120142

121143
@Test
122144
public void test3CreateDomainInTest1NS() throws Exception {
123-
Assume.assumeFalse(
124-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
145+
Assume.assumeFalse(QUICKTEST);
125146

126147
logTestBegin("test3CreateDomainInTest1NS");
127148
logger.info("Creating Domain domain3 & verifing the domain creation");
@@ -137,8 +158,7 @@ public void test3CreateDomainInTest1NS() throws Exception {
137158

138159
@Test
139160
public void test4CreateAnotherOperatorManagingTest2NS() throws Exception {
140-
Assume.assumeFalse(
141-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
161+
Assume.assumeFalse(QUICKTEST);
142162

143163
logTestBegin("test4CreateAnotherOperatorManagingTest2NS");
144164
logger.info("Creating Operator & waiting for the script to complete execution");
@@ -149,8 +169,7 @@ public void test4CreateAnotherOperatorManagingTest2NS() throws Exception {
149169

150170
@Test
151171
public void test5CreateConfiguredDomainInTest2NS() throws Exception {
152-
Assume.assumeFalse(
153-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
172+
Assume.assumeFalse(QUICKTEST);
154173

155174
logTestBegin("test5CreateConfiguredDomainInTest2NS");
156175
logger.info("Creating Domain domain4 & verifing the domain creation");
@@ -159,124 +178,159 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
159178
if (operator1 == null) {
160179
operator1 = TestUtils.createOperator(op1YamlFile);
161180
}
162-
if (domain1 == null) {
163-
domain1 = TestUtils.createDomain(domain1YamlFile);
164-
} else {
165-
domain1.create();
166-
}
181+
Domain domain4 = TestUtils.createDomain(domain4YamlFile);
182+
167183
logger.info("Checking if operator2 is running, if not creating");
168184
if (operator2 == null) {
169185
operator2 = TestUtils.createOperator(op2YamlFile);
170186
}
171-
// create domain4
172-
Domain domain4 = testDomainCreation(domain4YamlFile);
187+
// create domain5 with configured cluster
188+
Domain domain5 = testDomainCreation(domain5YamlFile);
173189

174-
logger.info("Verify the only remaining running domain domain1 is unaffected");
175-
domain1.verifyDomainCreated();
190+
logger.info("Verify the only remaining running domain domain4 is unaffected");
191+
domain4.verifyDomainCreated();
176192

177-
testClusterScaling(operator2, domain4);
193+
testClusterScaling(operator2, domain5);
178194

179-
logger.info("Verify the only remaining running domain domain1 is unaffected");
180-
domain1.verifyDomainCreated();
195+
logger.info("Verify the only remaining running domain domain4 is unaffected");
196+
domain4.verifyDomainCreated();
181197

182-
logger.info("Destroy and create domain1 and verify no impact on domain4");
183-
domain1.destroy();
184-
domain1.create();
198+
logger.info("Destroy and create domain4 and verify no impact on domain5");
199+
domain4.destroy();
200+
domain4.create();
185201

186-
logger.info("Verify no impact on domain4");
187-
domain4.verifyDomainCreated();
202+
logger.info("Verify no impact on domain5");
203+
domain5.verifyDomainCreated();
204+
domain5.destroy();
188205
domain4.destroy();
189-
domain1.destroy();
190206
logger.info("SUCCESS - test5CreateConfiguredDomainInTest2NS");
191207
}
192208

193209
@Test
194210
public void test6CreateDomainWithStartPolicyAdminOnly() throws Exception {
195-
Assume.assumeFalse(
196-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
211+
Assume.assumeFalse(QUICKTEST);
197212

198213
logTestBegin("test6CreateDomainWithStartPolicyAdminOnly");
199214
logger.info("Checking if operator1 is running, if not creating");
200215
if (operator1 == null) {
201216
operator1 = TestUtils.createOperator(op1YamlFile);
202217
}
203-
logger.info("Creating Domain domain5 & verifing the domain creation");
204-
// create domain5
205-
Domain domain5 = TestUtils.createDomain(domain5YamlFile);
206-
domain5.destroy();
218+
logger.info("Creating Domain domain6 & verifing the domain creation");
219+
// create domain6
220+
Domain domain6 = TestUtils.createDomain(domain6YamlFile);
221+
domain6.destroy();
207222
logger.info("SUCCESS - test6CreateDomainWithStartPolicyAdminOnly");
208223
}
209224

210225
@Test
211226
public void test7CreateDomainPVReclaimPolicyRecycle() throws Exception {
212-
Assume.assumeFalse(
213-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
227+
Assume.assumeFalse(QUICKTEST);
214228

215229
logTestBegin("test7CreateDomainPVReclaimPolicyRecycle");
216230
logger.info("Checking if operator1 is running, if not creating");
217231
if (operator1 == null) {
218232
operator1 = TestUtils.createOperator(op1YamlFile);
219233
}
220-
logger.info("Creating Domain domain6 & verifing the domain creation");
221-
// create domain6
222-
Domain domain6 = TestUtils.createDomain(domain6YamlFile);
223-
domain6.shutdown();
224-
domain6.deletePVCAndCheckPVReleased();
234+
logger.info("Creating Domain domain7 & verifing the domain creation");
235+
// create domain7
236+
Domain domain7 = TestUtils.createDomain(domain7YamlFile);
237+
domain7.shutdown();
238+
domain7.deletePVCAndCheckPVReleased();
225239
logger.info("SUCCESS - test7CreateDomainPVReclaimPolicyRecycle");
226240
}
227241

228242
@Test
229-
public void test9CreateDomainOnExistingDir() throws Exception {
230-
Assume.assumeFalse(
231-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
243+
public void test8CreateDomainOnExistingDir() throws Exception {
244+
Assume.assumeFalse(QUICKTEST);
232245

233-
logTestBegin("test9CreateDomainOnExistingDir");
246+
logTestBegin("test8CreateDomainOnExistingDir");
234247
if (operator1 == null) {
235248
operator1 = TestUtils.createOperator(op1YamlFile);
236249
}
237-
if (domain1 == null) {
238-
domain1 = TestUtils.createDomain(domain1YamlFile);
239-
// create domain on existing dir
240-
domain1.destroy();
241-
}
242-
logger.info("domain1 " + domain1);
243-
domain1.createDomainOnExistingDirectory();
244-
logger.info("SUCCESS - test9CreateDomainOnExistingDir");
250+
251+
Domain domain8 = TestUtils.createDomain(domain8YamlFile);
252+
// create domain on existing dir
253+
domain8.destroy();
254+
255+
domain8.createDomainOnExistingDirectory();
256+
logger.info("SUCCESS - test8CreateDomainOnExistingDir");
245257
}
246258

247259
// @Test
248260
public void testACreateDomainApacheLB() throws Exception {
249-
Assume.assumeFalse(
250-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
261+
Assume.assumeFalse(QUICKTEST);
262+
251263
logTestBegin("testACreateDomainApacheLB");
252-
logger.info("Creating Domain domain7 & verifing the domain creation");
264+
logger.info("Creating Domain domain9 & verifing the domain creation");
253265
if (operator1 == null) {
254266
operator1 = TestUtils.createOperator(op1YamlFile);
255267
}
256268

257269
// create domain7
258-
Domain domain7 = TestUtils.createDomain(domain7YamlFile);
259-
domain7.verifyAdminConsoleViaLB();
260-
domain7.destroy();
270+
Domain domain9 = TestUtils.createDomain(domain9YamlFile);
271+
domain9.verifyAdminConsoleViaLB();
272+
domain9.destroy();
261273
logger.info("SUCCESS - testACreateDomainApacheLB");
262274
}
263275

264276
@Test
265277
public void testBCreateDomainWithDefaultValuesInSampleInputs() throws Exception {
266-
Assume.assumeFalse(
267-
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true"));
278+
Assume.assumeFalse(QUICKTEST);
279+
268280
logTestBegin("testBCreateDomainWithDefaultValuesInSampleInputs");
269-
logger.info("Creating Domain domain8 & verifing the domain creation");
281+
logger.info("Creating Domain domain10 & verifing the domain creation");
270282
if (operator1 == null) {
271283
operator1 = TestUtils.createOperator(op1YamlFile);
272284
}
273285

274-
// create domain8
275-
Domain domain8 = testAllUseCasesForADomain(operator1, domain8YamlFile);
276-
domain8.destroy();
286+
// create domain10
287+
Domain domain10 = testAllUseCasesForADomain(operator1, domain10YamlFile);
288+
domain10.destroy();
277289
logger.info("SUCCESS - testBCreateDomainWithDefaultValuesInSampleInputs");
278290
}
279291

292+
@Test
293+
public void testDeleteOneDomain() throws Exception {
294+
Assume.assumeFalse(QUICKTEST);
295+
logTestBegin("Deleting one domain.");
296+
297+
if (operatorForDel1 == null) {
298+
logger.info("About to create operator");
299+
operatorForDel1 = TestUtils.createOperator(opForDelYamlFile1);
300+
}
301+
final Domain domain = TestUtils.createDomain(domain1ForDelValueYamlFile);
302+
TestUtils.verifyBeforeDeletion(domain);
303+
304+
logger.info("About to delete domain: " + domain.getDomainUid());
305+
TestUtils.deleteWeblogicDomainResources(domain.getDomainUid());
306+
307+
TestUtils.verifyAfterDeletion(domain);
308+
}
309+
310+
@Test
311+
public void testDeleteTwoDomains() throws Exception {
312+
Assume.assumeFalse(QUICKTEST);
313+
logTestBegin("Deleting two domains.");
314+
315+
if (operatorForDel2 == null) {
316+
logger.info("About to create operator");
317+
operatorForDel2 = TestUtils.createOperator(opForDelYamlFile2);
318+
}
319+
final Domain domainDel1 = TestUtils.createDomain(domain2ForDelValueYamlFile);
320+
final Domain domainDel2 = TestUtils.createDomain(domain3ForDelValueYamlFile);
321+
322+
TestUtils.verifyBeforeDeletion(domainDel1);
323+
TestUtils.verifyBeforeDeletion(domainDel2);
324+
325+
final String domainUidsToBeDeleted =
326+
domainDel1.getDomainUid() + "," + domainDel2.getDomainUid();
327+
logger.info("About to delete domains: " + domainUidsToBeDeleted);
328+
TestUtils.deleteWeblogicDomainResources(domainUidsToBeDeleted);
329+
330+
TestUtils.verifyAfterDeletion(domainDel1);
331+
TestUtils.verifyAfterDeletion(domainDel2);
332+
}
333+
280334
private void testCreateOperatorManagingDefaultAndTest1NS() throws Exception {
281335
logger.info("Creating Operator & waiting for the script to complete execution");
282336
// create operator1
@@ -288,9 +342,11 @@ private Domain testAllUseCasesForADomain(Operator operator, String domainYamlFil
288342
logger.info("Creating Domain & verifing the domain creation");
289343
// create domain1
290344
Domain domain = testDomainCreation(domainYamlFile);
291-
testClusterScaling(operator, domain);
292-
testDomainLifecyle(operator, domain);
293-
testOperatorLifecycle(operator, domain);
345+
if (!SMOKETEST) {
346+
testClusterScaling(operator, domain);
347+
testDomainLifecyle(operator, domain);
348+
testOperatorLifecycle(operator, domain);
349+
}
294350
return domain;
295351
}
296352

0 commit comments

Comments
 (0)