Skip to content

Commit 218d509

Browse files
committed
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernetes-operator into chshi-OWLS-67963-upd-del-sh
2 parents b33832c + ec58713 commit 218d509

File tree

127 files changed

+8042
-2746
lines changed

Some content is hidden

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

127 files changed

+8042
-2746
lines changed

integration-tests/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,12 @@ mvn -Dit.test="ITOperator#test6CreateConfiguredDomainInTest2NS" -DfailIfNoTests=
268268

269269
mvn -Dit.test="ITOperator#test6CreateConfiguredDomainInTest2NS+test7CreateDomainPVReclaimPolicyRecycle" -DfailIfNoTests=false integration-test -P java-integration-tests
270270

271+
# How to run cleanup script
272+
273+
cleanup script deletes the k8s artifacts, local test tmp directory, delete all helm charts and the potentially remote domain pv directories.
274+
cd weblogic-kubernetes-operator
275+
src/integration-tests/bash/cleanup.sh
276+
271277
# Logging/Archiving
272278

273279
Java utils logging is used, writes all the messages to console and java_test_suite.out in $RESULT_ROOT/acceptance_test_tmp directory.

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

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ public void test1CreateFirstOperatorAndDomain() throws Exception {
105105
logTestBegin("test1CreateFirstOperatorAndDomain");
106106
testCreateOperatorManagingDefaultAndTest1NS();
107107
domain1 = testAllUseCasesForADomain(operator1, domain1YamlFile);
108+
domain1.testWlsLivenessProbe();
109+
domain1.destroy();
110+
108111
logger.info("SUCCESS - test1CreateFirstOperatorAndDomain");
109112
}
110113

@@ -139,6 +142,7 @@ public void test3CreateDomainInTest1NS() throws Exception {
139142
// create domain3
140143
Domain domain3 = testDomainCreation(domain3YamlFile);
141144
testWLDFScaling(operator1, domain3);
145+
domain3.destroy();
142146
logger.info("SUCCESS - test3CreateDomainInTest1NS");
143147
}
144148

@@ -168,6 +172,8 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
168172
}
169173
if (domain1 == null) {
170174
domain1 = TestUtils.createDomain(domain1YamlFile);
175+
} else {
176+
domain1.create();
171177
}
172178
logger.info("Checking if operator2 is running, if not creating");
173179
if (operator2 == null) {
@@ -190,6 +196,8 @@ public void test5CreateConfiguredDomainInTest2NS() throws Exception {
190196

191197
logger.info("Verify no impact on domain4");
192198
domain4.verifyDomainCreated();
199+
domain4.destroy();
200+
domain1.destroy();
193201
logger.info("SUCCESS - test5CreateConfiguredDomainInTest2NS");
194202
}
195203

@@ -205,7 +213,8 @@ public void test6CreateDomainWithStartPolicyAdminOnly() throws Exception {
205213
}
206214
logger.info("Creating Domain domain5 & verifing the domain creation");
207215
// create domain5
208-
TestUtils.createDomain(domain5YamlFile);
216+
Domain domain5 = TestUtils.createDomain(domain5YamlFile);
217+
domain5.destroy();
209218
logger.info("SUCCESS - test6CreateDomainWithStartPolicyAdminOnly");
210219
}
211220

@@ -227,25 +236,6 @@ public void test7CreateDomainPVReclaimPolicyRecycle() throws Exception {
227236
logger.info("SUCCESS - test7CreateDomainPVReclaimPolicyRecycle");
228237
}
229238

230-
@Test
231-
public void test8WlsLivenessProbe() throws Exception {
232-
233-
logTestBegin("test8WlsLivenessProbe");
234-
logger.info("Checking if operator1 is running, if not creating");
235-
if (operator1 == null) {
236-
operator1 = TestUtils.createOperator(op1YamlFile);
237-
}
238-
if (domain1 == null) {
239-
domain1 = TestUtils.createDomain(domain1YamlFile);
240-
}
241-
// test managed server1 pod auto restart
242-
String domain = domain1.getDomainUid();
243-
String namespace = domain1.getDomainMap().get("namespace").toString();
244-
String serverName = domain1.getDomainMap().get("managedServerNameBase").toString() + "1";
245-
TestUtils.testWlsLivenessProbe(domain, serverName, namespace);
246-
logger.info("SUCCESS - test8WlsLivenessProbe");
247-
}
248-
249239
@Test
250240
public void test9CreateDomainOnExistingDir() throws Exception {
251241
Assume.assumeFalse(
@@ -257,10 +247,10 @@ public void test9CreateDomainOnExistingDir() throws Exception {
257247
}
258248
if (domain1 == null) {
259249
domain1 = TestUtils.createDomain(domain1YamlFile);
250+
// create domain on existing dir
251+
domain1.destroy();
260252
}
261253
logger.info("domain1 " + domain1);
262-
// create domain on existing dir
263-
domain1.destroy();
264254
domain1.createDomainOnExistingDirectory();
265255
logger.info("SUCCESS - test9CreateDomainOnExistingDir");
266256
}
@@ -278,6 +268,7 @@ public void testACreateDomainApacheLB() throws Exception {
278268
// create domain7
279269
Domain domain7 = TestUtils.createDomain(domain7YamlFile);
280270
domain7.verifyAdminConsoleViaLB();
271+
domain7.destroy();
281272
logger.info("SUCCESS - testACreateDomainApacheLB");
282273
}
283274

@@ -292,7 +283,8 @@ public void testBCreateDomainWithDefaultValuesInSampleInputs() throws Exception
292283
}
293284

294285
// create domain8
295-
testAllUseCasesForADomain(operator1, domain8YamlFile);
286+
Domain domain8 = testAllUseCasesForADomain(operator1, domain8YamlFile);
287+
domain8.destroy();
296288
logger.info("SUCCESS - testBCreateDomainWithDefaultValuesInSampleInputs");
297289
}
298290

@@ -402,9 +394,9 @@ private Domain testAllUseCasesForADomain(Operator operator, String domainYamlFil
402394
logger.info("Creating Domain & verifing the domain creation");
403395
// create domain1
404396
Domain domain = testDomainCreation(domainYamlFile);
397+
testClusterScaling(operator, domain);
405398
testDomainLifecyle(operator, domain);
406399
testOperatorLifecycle(operator, domain);
407-
testClusterScaling(operator, domain);
408400
return domain;
409401
}
410402

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,13 @@ public String getDomainUid() {
510510
return domainUid;
511511
}
512512

513+
public void testWlsLivenessProbe() throws Exception {
514+
515+
// test managed server1 pod auto restart
516+
String serverName = managedServerNameBase + "1";
517+
TestUtils.testWlsLivenessProbe(domainUid, serverName, domainNS);
518+
}
519+
513520
private int getAdminSericeLBNodePort() throws Exception {
514521

515522
String adminServerLBNodePortService = domainUid + "-apache-webtier";

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

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,48 @@ private void callHelmInstall() throws Exception {
202202
logger.info("Running " + cmd);
203203
ExecResult result = ExecCommand.exec(cmd.toString());
204204
if (result.exitValue() != 0) {
205-
throw new RuntimeException(
206-
"FAILURE: command "
207-
+ cmd
208-
+ " failed, returned "
209-
+ result.stdout()
210-
+ "\n"
211-
+ result.stderr());
205+
reportHelmInstallFailure(cmd.toString(), result);
212206
}
213207
String outputStr = result.stdout().trim();
214208
logger.info("Command returned " + outputStr);
215209
}
216210

211+
private void reportHelmInstallFailure(String cmd, ExecResult result) throws Exception {
212+
String cause = getExecFailure(cmd, result);
213+
if (result.stderr().contains("Error: Job failed: BackoffLimitExceeded")) {
214+
// The operator helm chart pre-install hook probably failed.
215+
// This is probably because there is a problem with the values passed in,
216+
// for example a listed domain namespace does not exist.
217+
// Fetch the pre-install hook's results and return it too.
218+
String hookResults = getOperatorHelmChartHookResults("pre-install");
219+
cause = cause + "\n pre-install-hook returned\n" + hookResults;
220+
}
221+
throw new RuntimeException(cause);
222+
}
223+
224+
private String getOperatorHelmChartHookResults(String hookType) throws Exception {
225+
String cmd =
226+
"kubectl logs job/"
227+
+ operatorMap.get("releaseName")
228+
+ "-weblogic-operator-"
229+
+ hookType
230+
+ "-hook -n kube-system";
231+
ExecResult result = ExecCommand.exec(cmd);
232+
if (result.exitValue() != 0) {
233+
return getExecFailure(cmd, result);
234+
}
235+
return result.stdout();
236+
}
237+
238+
private String getExecFailure(String cmd, ExecResult result) throws Exception {
239+
return "FAILURE: command "
240+
+ cmd
241+
+ " failed, stdout:\n"
242+
+ result.stdout()
243+
+ "stderr:\n"
244+
+ result.stderr();
245+
}
246+
217247
private void generateInputYaml() throws Exception {
218248
Path parentDir =
219249
Files.createDirectories(Paths.get(userProjectsDir + "/weblogic-operators/" + operatorNS));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ serviceAccount: weblogic-operator
77
namespace: weblogic-operator1
88
domainNamespaces: [ "default", "test1" ]
99
externalRestEnabled: true
10-
javaLoggingLevel: FINE
10+
javaLoggingLevel: FINE

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ namespace: weblogic-operator2
88
domainNamespaces: [ "test2" ]
99
externalRestEnabled: true
1010
externalRestHttpsPort: 32001
11-
javaLoggingLevel: FINE
11+
javaLoggingLevel: FINE

0 commit comments

Comments
 (0)