Skip to content

Commit 74813ef

Browse files
ItMiiDynamicUpdate - maintain model changes in the tests (#2304)
* fix changes in model
1 parent 57d009e commit 74813ef

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDynamicUpdate.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class ItMiiDynamicUpdate {
129129
private final String workManagerName = "newWM";
130130
private static Path pathToChangeTargetYaml = null;
131131
private static Path pathToAddClusterYaml = null;
132+
private static Path pathToChangReadsYaml = null;
132133
private static LoggingFacade logger = null;
133134

134135
/**
@@ -246,6 +247,14 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
246247
+ " ListenPort : 8001";
247248

248249
assertDoesNotThrow(() -> Files.write(pathToAddClusterYaml, yamlToAddCluster.getBytes()));
250+
251+
// write sparse yaml to change ScatteredReadsEnabled for adminserver
252+
pathToChangReadsYaml = Paths.get(WORK_DIR + "/changereads.yaml");
253+
String yamlToChangeReads = "topology:\n"
254+
+ " Server:\n"
255+
+ " \"admin-server\":\n"
256+
+ " ScatteredReadsEnabled: true";
257+
assertDoesNotThrow(() -> Files.write(pathToChangReadsYaml, yamlToChangeReads.getBytes()));
249258
}
250259

251260
/**
@@ -910,14 +919,6 @@ public void testOnNonDynamicChangesCommitUpdateOnly() {
910919
// BeforeEach method ensures that the server pods are running
911920
LinkedHashMap<String, OffsetDateTime> pods = addDataSourceAndVerify(false);
912921

913-
// write sparse yaml to change ScatteredReadsEnabled for adminserver
914-
Path pathToChangReadsYaml = Paths.get(WORK_DIR + "/changereads.yaml");
915-
String yamlToChangeReads = "topology:\n"
916-
+ " Server:\n"
917-
+ " \"admin-server\":\n"
918-
+ " ScatteredReadsEnabled: true";
919-
assertDoesNotThrow(() -> Files.write(pathToChangReadsYaml, yamlToChangeReads.getBytes()));
920-
921922
// make two non-dynamic changes, add datasource JDBC driver params and change scatteredreadenabled
922923
replaceConfigMapWithModelFiles(configMapName, domainUid, domainNamespace,
923924
Arrays.asList(MODEL_DIR + "/model.config.wm.yaml", pathToAddClusterYaml.toString(),
@@ -1052,7 +1053,8 @@ public void testMiiUpdateDynamicClusterSize() {
10521053
// after the cluster is scaled.
10531054
replaceConfigMapWithModelFiles(configMapName, domainUid, domainNamespace,
10541055
Arrays.asList(MODEL_DIR + "/model.config.wm.yaml", pathToAddClusterYaml.toString(),
1055-
MODEL_DIR + "/model.jdbc2.yaml", MODEL_DIR + "/model.cluster.size.yaml"), withStandardRetryPolicy);
1056+
MODEL_DIR + "/model.jdbc2.updatejdbcdriverparams.yaml", pathToChangReadsYaml.toString(),
1057+
MODEL_DIR + "/model.cluster.size.yaml"), withStandardRetryPolicy);
10561058

10571059
// Patch a running domain with introspectVersion.
10581060
String introspectVersion = patchDomainResourceWithNewIntrospectVersion(domainUid, domainNamespace);
@@ -1158,7 +1160,8 @@ public void testMiiRemoveTarget() {
11581160
// Replace contents of an existing configMap
11591161
replaceConfigMapWithModelFiles(configMapName, domainUid, domainNamespace,
11601162
Arrays.asList(MODEL_DIR + "/model.config.wm.yaml", pathToAddClusterYaml.toString(),
1161-
MODEL_DIR + "/model.jdbc2.yaml", MODEL_DIR + "/model.cluster.size.yaml",
1163+
MODEL_DIR + "/model.jdbc2.updatejdbcdriverparams.yaml",
1164+
pathToChangReadsYaml.toString(), MODEL_DIR + "/model.cluster.size.yaml",
11621165
pathToRemoveTargetYaml.toString()), withStandardRetryPolicy);
11631166

11641167
// Patch a running domain with introspectVersion.

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import static oracle.weblogic.kubernetes.actions.TestActions.createSecret;
5858
import static oracle.weblogic.kubernetes.actions.TestActions.deleteConfigMap;
5959
import static oracle.weblogic.kubernetes.actions.TestActions.getJob;
60+
import static oracle.weblogic.kubernetes.actions.TestActions.getPod;
6061
import static oracle.weblogic.kubernetes.actions.TestActions.getPodLog;
6162
import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
6263
import static oracle.weblogic.kubernetes.actions.TestActions.listPods;
@@ -752,6 +753,20 @@ public static void verifyIntrospectorRuns(String domainUid, String domainNamespa
752753
logger.info("Verifying introspector pod is created, runs and deleted");
753754
String introspectJobName = getIntrospectJobName(domainUid);
754755
checkPodExists(introspectJobName, domainUid, domainNamespace);
756+
757+
String labelSelector = String.format("weblogic.domainUID in (%s)", domainUid);
758+
V1Pod introspectorPod = assertDoesNotThrow(() -> getPod(domainNamespace, labelSelector, introspectJobName),
759+
"Could not get introspector pod");
760+
assertTrue(introspectorPod != null && introspectorPod.getMetadata() != null,
761+
"introspector pod or metadata is null");
762+
try {
763+
String introspectorLog = getPodLog(introspectorPod.getMetadata().getName(), domainNamespace);
764+
logger.info("Introspector pod log START");
765+
logger.info(introspectorLog);
766+
logger.info("Introspector pod log END");
767+
} catch (Exception ex) {
768+
logger.info("Failed to get introspector pod log", ex);
769+
}
755770
checkPodDoesNotExist(introspectJobName, domainUid, domainNamespace);
756771
}
757772

0 commit comments

Comments
 (0)