Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1848730

Browse files
xiancaoddsharpe
authored andcommitted
backport MR 4899 to main
1 parent 1b58986 commit 1848730

File tree

3 files changed

+122
-126
lines changed

3 files changed

+122
-126
lines changed

‎integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMaxConcurOptions.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2023, 2024, Oracle and/or its affiliates.
1+
// Copyright (c) 2023, 2025, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes;
@@ -89,7 +89,7 @@
8989
@DisplayName("Test to a create model in image domain with Cluster Resourcees")
9090
@IntegrationTest
9191
@Tag("kind-parallel")
92-
@Tag("olcne-mrg")
92+
@Tag("olcne-sequential")
9393
class ItMaxConcurOptions {
9494

9595
private static String opNamespace = null;

‎integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDynamicUpdatePart1.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2021, 2024, Oracle and/or its affiliates.
1+
// Copyright (c) 2021, 2025, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes;
@@ -140,7 +140,6 @@ public void beforeEach() {
140140
@Test
141141
@Order(1)
142142
@DisplayName("Add a work manager to a model-in-image domain using dynamic update")
143-
@Tag("crio")
144143
void testMiiAddWorkManager() {
145144

146145
// This test uses the WebLogic domain created in BeforeAll method

‎integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiUpdateDomainConfig.java‎

Lines changed: 119 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, 2024, Oracle and/or its affiliates.
1+
// Copyright (c) 2020, 2025, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.weblogic.kubernetes;
@@ -116,7 +116,7 @@
116116
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
117117
@DisplayName("Test logHome on PV, add SystemResources, Clusters to model in image domain")
118118
@IntegrationTest
119-
@Tag("olcne-mrg")
119+
@Tag("olcne-sequential")
120120
@Tag("kind-parallel")
121121
@Tag("toolkits-srg")
122122
@Tag("okd-wls-srg")
@@ -192,7 +192,6 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
192192
configMapName, domainUid, domainNamespace,
193193
Arrays.asList(MODEL_DIR + "/model.sysresources.yaml"));
194194

195-
196195
// create pull secrets for WebLogic image when running in non Kind Kubernetes cluster
197196
// this secret is used only for non-kind cluster
198197
createBaseRepoSecret(domainNamespace);
@@ -257,7 +256,7 @@ public void beforeEach() {
257256
* Check the environment variable with special characters.
258257
*/
259258
@Test
260-
@Order(0)
259+
@Order(1)
261260
@DisplayName("Check environment variable with special characters")
262261
void testMiiCustomEnv() {
263262
DomainResource domain1 = assertDoesNotThrow(() -> getDomainCustomResource(domainUid, domainNamespace),
@@ -271,7 +270,7 @@ void testMiiCustomEnv() {
271270
if (envList.get(i).getName().equalsIgnoreCase("CUSTOM_ENV")) {
272271
assertTrue(envList.get(i).getValue() != null
273272
&& envList.get(i).getValue().equalsIgnoreCase("${DOMAIN_UID}~##!'%*$(ls)"),
274-
"Expected value for CUSTOM_ENV variable does not mtach");
273+
"Expected value for CUSTOM_ENV variable does not match");
275274
found = true;
276275
}
277276
}
@@ -320,7 +319,7 @@ void testMiiCustomEnv() {
320319
* The test looks for the string RUNNING in the server log
321320
*/
322321
@Test
323-
@Order(1)
322+
@Order(2)
324323
@DisplayName("Check the server logs are written to PersistentVolume")
325324
void testMiiServerLogsAreOnPV() {
326325
// check server logs are written on PV and look for string RUNNING in log
@@ -334,7 +333,7 @@ void testMiiServerLogsAreOnPV() {
334333
* logs
335334
*/
336335
@Test
337-
@Order(2)
336+
@Order(3)
338337
@DisplayName("Check the HTTP server logs are written to PersistentVolume")
339338
void testMiiHttpServerLogsAreOnPV() {
340339
String[] podNames = {managedServerPrefix + "1", managedServerPrefix + "2"};
@@ -369,7 +368,7 @@ void testMiiHttpServerLogsAreOnPV() {
369368
* using the public node port of the administration server.
370369
*/
371370
@Test
372-
@Order(3)
371+
@Order(4)
373372
@DisplayName("Verify the pre-configured SystemResources in the domain")
374373
void testMiiCheckSystemResources() {
375374

@@ -424,6 +423,84 @@ void testMiiCheckSystemResources() {
424423
}
425424
}
426425

426+
/**
427+
* Start a WebLogic domain using model-in-image with JMS/JDBC SystemResources.
428+
* Create a empty configmap to delete JMS/JDBC SystemResources
429+
* Patch the domain resource with the configmap.
430+
* Update the restart version of the domain resource.
431+
* Verify rolling restart of the domain by comparing PodCreationTimestamp
432+
* for all the server pods before and after rolling restart.
433+
* Verify SystemResources are deleted from the domain.
434+
*/
435+
@Test
436+
@Order(5)
437+
@DisplayName("Delete SystemResources from the domain")
438+
void testMiiDeleteSystemResourcesByEmptyConfigMap() {
439+
440+
String configMapName = "deletesysrescm";
441+
createConfigMapAndVerify(
442+
configMapName, domainUid, domainNamespace,
443+
Arrays.asList(MODEL_DIR + "/model.delete.sysresourcesbyconfigmap.yaml"));
444+
445+
LinkedHashMap<String, OffsetDateTime> pods = new LinkedHashMap<>();
446+
// get the creation time of the admin server pod before patching
447+
OffsetDateTime adminPodCreationTime = getPodCreationTime(domainNamespace,adminServerPodName);
448+
pods.put(adminServerPodName, adminPodCreationTime);
449+
// get the creation time of the managed server pods before patching
450+
for (int i = 1; i <= replicaCount; i++) {
451+
pods.put(managedServerPrefix + i, getPodCreationTime(domainNamespace, managedServerPrefix + i));
452+
}
453+
454+
StringBuffer patchStr = null;
455+
patchStr = new StringBuffer("[{");
456+
patchStr.append("\"op\": \"replace\",")
457+
.append(" \"path\": \"/spec/configuration/model/configMap\",")
458+
.append(" \"value\": \"" + configMapName + "\"")
459+
.append(" }]");
460+
logger.log(Level.INFO, "Configmap patch string: {0}", patchStr);
461+
462+
patch = new V1Patch(new String(patchStr));
463+
boolean cmPatched = assertDoesNotThrow(() ->
464+
patchDomainCustomResource(domainUid, domainNamespace, patch, "application/json-patch+json"),
465+
"patchDomainCustomResource(configMap) failed ");
466+
assertTrue(cmPatched, "patchDomainCustomResource(configMap) failed");
467+
468+
String newRestartVersion = patchDomainResourceWithNewRestartVersion(domainUid, domainNamespace);
469+
logger.log(Level.INFO, "New restart version is {0}", newRestartVersion);
470+
471+
assertTrue(verifyRollingRestartOccurred(pods, 1, domainNamespace),
472+
"Rolling restart failed");
473+
474+
// Even if pods are created, need the service to created
475+
for (int i = 1; i <= replicaCount; i++) {
476+
logger.info("Check managed server service {0} created in namespace {1}",
477+
managedServerPrefix + i, domainNamespace);
478+
checkServiceExists(managedServerPrefix + i, domainNamespace);
479+
}
480+
481+
if (OKE_CLUSTER || OCNE) {
482+
String resourcePath = "/management/weblogic/latest/domainConfig/JDBCSystemResources/TestDataSource";
483+
ExecResult result = exeAppInServerPod(domainNamespace, adminServerPodName, 7001, resourcePath);
484+
assertEquals(0, result.exitValue(), "Failed to delete the JDBCSystemResource configuration");
485+
assertTrue(result.toString().contains("404"), "Failed to delete the JDBCSystemResource configuration");
486+
logger.info("The JDBCSystemResource configuration is deleted");
487+
488+
resourcePath = "/management/weblogic/latest/domainConfig/JMSSystemResources/TestClusterJmsModule";
489+
result = exeAppInServerPod(domainNamespace, adminServerPodName, 7001, resourcePath);
490+
assertEquals(0, result.exitValue(), "Failed to delete the JMSSystemResources configuration");
491+
assertTrue(result.toString().contains("404"), "Failed to delete the JMSSystemResources configuration");
492+
logger.info("The JMSSystemResource configuration is deleted");
493+
} else {
494+
int adminServiceNodePort
495+
= getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default");
496+
assertNotEquals(-1, adminServiceNodePort, "admin server default node port is not valid");
497+
verifySystemResourceConfiguration(adminSvcExtHost, adminServiceNodePort,
498+
"JDBCSystemResources", "TestDataSource", "404", hostHeader);
499+
verifySystemResourceConfiguration(adminSvcExtHost, adminServiceNodePort,
500+
"JMSSystemResources", "TestClusterJmsModule", "404", hostHeader);
501+
}
502+
}
503+
427504
/**
428505
* Start a WebLogic domain using model-in-image.
429506
* Create 1 configmap with 2 models files, one of them to add JMS/JDBC SystemResources
@@ -435,7 +512,7 @@ void testMiiCheckSystemResources() {
435512
* Verify SystemResources are deleted from the domain.
436513
*/
437514
@Test
438-
@Order(5)
515+
@Order(6)
439516
@DisplayName("Delete SystemResources from the domain")
440517
void testMiiDeleteSystemResources() {
441518

@@ -516,7 +593,7 @@ void testMiiDeleteSystemResources() {
516593
* Verify JMS Server logs are written on PV.
517594
*/
518595
@Test
519-
@Order(6)
596+
@Order(7)
520597
@DisplayName("Add new JDBC/JMS SystemResources to the domain")
521598
void testMiiAddSystemResources() {
522599

@@ -604,7 +681,7 @@ void testMiiAddSystemResources() {
604681
* Verify servers from the new cluster are running.
605682
*/
606683
@Test
607-
@Order(7)
684+
@Order(8)
608685
@DisplayName("Add a dynamic cluster to domain with non-zero replica count")
609686
void testMiiAddDynamicCluster() {
610687

@@ -676,7 +753,7 @@ void testMiiAddDynamicCluster() {
676753
* Check the validity of new credentials by accessing WebLogic RESTful Service
677754
*/
678755
@Test
679-
@Order(8)
756+
@Order(9)
680757
@DisplayName("Change the WebLogic Admin credential of the domain")
681758
void testMiiUpdateWebLogicCredential() {
682759
verifyUpdateWebLogicCredential(7001, domainNamespace, domainUid, adminServerPodName,
@@ -698,7 +775,7 @@ void testMiiUpdateWebLogicCredential() {
698775
* Make sure JMS Connections and messages are distributed across 4 servers.
699776
*/
700777
@Test
701-
@Order(9)
778+
@Order(10)
702779
@DisplayName("Test modification to Dynamic cluster size parameters")
703780
void testMiiUpdateDynamicClusterSize() {
704781

@@ -714,7 +791,7 @@ void testMiiUpdateDynamicClusterSize() {
714791
checkPodReadyAndServiceExists(managedServerPrefix + "4", domainUid, domainNamespace);
715792
checkPodReadyAndServiceExists(managedServerPrefix + "5", domainUid, domainNamespace);
716793

717-
// Make sure that we can scale down upto replica count 1
794+
// Make sure that we can scale down replica count to 1
718795
// since the MinDynamicClusterSize is set to 1
719796
logger.info("[Before Patching] updating the replica count to 1");
720797
boolean p11Success = scaleCluster(domainUid + "-cluster-1", domainNamespace, 1);
@@ -814,112 +891,6 @@ void testMiiUpdateDynamicClusterSize() {
814891
logger.info("New Dynamic Cluster Size attribute verified");
815892
}
816893

817-
// Build JMS Client inside the Admin Server Pod
818-
private void buildClientOnPod() {
819-
820-
String destLocation = "/u01/JmsTestClient.java";
821-
assertDoesNotThrow(() -> copyFileToPod(domainNamespace,
822-
adminServerPodName, "",
823-
Paths.get(RESOURCE_DIR, "tunneling", "JmsTestClient.java"),
824-
Paths.get(destLocation)));
825-
826-
String jarLocation = "/u01/oracle/wlserver/server/lib/weblogic.jar";
827-
828-
StringBuffer javacCmd = new StringBuffer(KUBERNETES_CLI + " exec -n ");
829-
javacCmd.append(domainNamespace);
830-
javacCmd.append(" -it ");
831-
javacCmd.append(adminServerPodName);
832-
javacCmd.append(" -- /bin/bash -c \"");
833-
javacCmd.append("javac -cp ");
834-
javacCmd.append(jarLocation);
835-
javacCmd.append(" /u01/JmsTestClient.java ");
836-
javacCmd.append(" \"");
837-
logger.info("javac command {0}", javacCmd.toString());
838-
ExecResult result = assertDoesNotThrow(
839-
() -> exec(new String(javacCmd), true));
840-
logger.info("javac returned {0}", result.toString());
841-
logger.info("javac returned EXIT value {0}", result.exitValue());
842-
assertEquals(0, result.exitValue(), "Client compilation fails");
843-
}
844-
845-
/**
846-
* Start a WebLogic domain using model-in-image with JMS/JDBC SystemResources.
847-
* Create a empty configmap to delete JMS/JDBC SystemResources
848-
* Patch the domain resource with the configmap.
849-
* Update the restart version of the domain resource.
850-
* Verify rolling restart of the domain by comparing PodCreationTimestamp
851-
* for all the server pods before and after rolling restart.
852-
* Verify SystemResources are deleted from the domain.
853-
*/
854-
@Test
855-
@Order(4)
856-
@DisplayName("Delete SystemResources from the domain")
857-
void testMiiDeleteSystemResourcesByEmptyConfigMap() {
858-
859-
String configMapName = "deletesysrescm";
860-
createConfigMapAndVerify(
861-
configMapName, domainUid, domainNamespace,
862-
Arrays.asList(MODEL_DIR + "/model.delete.sysresourcesbyconfigmap.yaml"));
863-
864-
LinkedHashMap<String, OffsetDateTime> pods = new LinkedHashMap<>();
865-
// get the creation time of the admin server pod before patching
866-
OffsetDateTime adminPodCreationTime = getPodCreationTime(domainNamespace,adminServerPodName);
867-
pods.put(adminServerPodName, adminPodCreationTime);
868-
// get the creation time of the managed server pods before patching
869-
for (int i = 1; i <= replicaCount; i++) {
870-
pods.put(managedServerPrefix + i, getPodCreationTime(domainNamespace, managedServerPrefix + i));
871-
}
872-
873-
StringBuffer patchStr = null;
874-
patchStr = new StringBuffer("[{");
875-
patchStr.append("\"op\": \"replace\",")
876-
.append(" \"path\": \"/spec/configuration/model/configMap\",")
877-
.append(" \"value\": \"" + configMapName + "\"")
878-
.append(" }]");
879-
logger.log(Level.INFO, "Configmap patch string: {0}", patchStr);
880-
881-
patch = new V1Patch(new String(patchStr));
882-
boolean cmPatched = assertDoesNotThrow(() ->
883-
patchDomainCustomResource(domainUid, domainNamespace, patch, "application/json-patch+json"),
884-
"patchDomainCustomResource(configMap) failed ");
885-
assertTrue(cmPatched, "patchDomainCustomResource(configMap) failed");
886-
887-
String newRestartVersion = patchDomainResourceWithNewRestartVersion(domainUid, domainNamespace);
888-
logger.log(Level.INFO, "New restart version is {0}", newRestartVersion);
889-
890-
assertTrue(verifyRollingRestartOccurred(pods, 1, domainNamespace),
891-
"Rolling restart failed");
892-
893-
// Even if pods are created, need the service to created
894-
for (int i = 1; i <= replicaCount; i++) {
895-
logger.info("Check managed server service {0} created in namespace {1}",
896-
managedServerPrefix + i, domainNamespace);
897-
checkServiceExists(managedServerPrefix + i, domainNamespace);
898-
}
899-
900-
if (OKE_CLUSTER || OCNE) {
901-
String resourcePath = "/management/weblogic/latest/domainConfig/JDBCSystemResources/TestDataSource";
902-
ExecResult result = exeAppInServerPod(domainNamespace, adminServerPodName, 7001, resourcePath);
903-
assertEquals(0, result.exitValue(), "Failed to delete the JDBCSystemResource configuration");
904-
assertTrue(result.toString().contains("404"), "Failed to delete the JDBCSystemResource configuration");
905-
logger.info("The JDBCSystemResource configuration is deleted");
906-
907-
resourcePath = "/management/weblogic/latest/domainConfig/JMSSystemResources/TestClusterJmsModule";
908-
result = exeAppInServerPod(domainNamespace, adminServerPodName, 7001, resourcePath);
909-
assertEquals(0, result.exitValue(), "Failed to delete the JMSSystemResources configuration");
910-
assertTrue(result.toString().contains("404"), "Failed to delete the JMSSystemResources configuration");
911-
logger.info("The JMSSystemResource configuration is deleted");
912-
} else {
913-
int adminServiceNodePort
914-
= getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default");
915-
assertNotEquals(-1, adminServiceNodePort, "admin server default node port is not valid");
916-
verifySystemResourceConfiguration(adminSvcExtHost, adminServiceNodePort,
917-
"JDBCSystemResources", "TestDataSource", "404", hostHeader);
918-
verifySystemResourceConfiguration(adminSvcExtHost, adminServiceNodePort,
919-
"JMSSystemResources", "TestClusterJmsModule", "404", hostHeader);
920-
}
921-
}
922-
923894
// Run standalone JMS Client in the pod using wlthint3client.jar in classpath.
924895
// The client sends 300 messsage to a Uniform Distributed Queue.
925896
// Make sure that each destination get excatly 150 messages each.
@@ -933,7 +904,6 @@ private static Callable<Boolean> runJmsClient(String javaCmd) {
933904
});
934905
}
935906

936-
937907
private static void createDatabaseSecret(
938908
String secretName, String username, String password,
939909
String dburl, String domNamespace) {
@@ -1112,7 +1082,6 @@ private void verifyJdbcRuntime(String resourcesName, String expectedOutput) {
11121082
headers = " -H 'host: " + hostHeader + "' ";
11131083
}
11141084

1115-
ExecResult result = null;
11161085
curlString = new StringBuffer("curl -g --user ")
11171086
.append(ADMIN_USERNAME_DEFAULT)
11181087
.append(":")
@@ -1150,4 +1119,32 @@ private void checkLogsOnPV(String commandToExecuteInsidePod, String podName) {
11501119
String.format("Command %s failed with exit value %s, stderr %s, stdout %s",
11511120
commandToExecuteInsidePod, result.exitValue(), result.stderr(), result.stdout()));
11521121
}
1122+
1123+
// Build JMS Client inside the Admin Server Pod
1124+
private void buildClientOnPod() {
1125+
1126+
String destLocation = "/u01/JmsTestClient.java";
1127+
assertDoesNotThrow(() -> copyFileToPod(domainNamespace,
1128+
adminServerPodName, "",
1129+
Paths.get(RESOURCE_DIR, "tunneling", "JmsTestClient.java"),
1130+
Paths.get(destLocation)));
1131+
1132+
String jarLocation = "/u01/oracle/wlserver/server/lib/weblogic.jar";
1133+
1134+
StringBuffer javacCmd = new StringBuffer(KUBERNETES_CLI + " exec -n ");
1135+
javacCmd.append(domainNamespace);
1136+
javacCmd.append(" -it ");
1137+
javacCmd.append(adminServerPodName);
1138+
javacCmd.append(" -- /bin/bash -c \"");
1139+
javacCmd.append("javac -cp ");
1140+
javacCmd.append(jarLocation);
1141+
javacCmd.append(" /u01/JmsTestClient.java ");
1142+
javacCmd.append(" \"");
1143+
logger.info("javac command {0}", javacCmd.toString());
1144+
ExecResult result = assertDoesNotThrow(
1145+
() -> exec(new String(javacCmd), true));
1146+
logger.info("javac returned {0}", result.toString());
1147+
logger.info("javac returned EXIT value {0}", result.exitValue());
1148+
assertEquals(0, result.exitValue(), "Client compilation fails");
1149+
}
11531150
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /