|
21 | 21 | import oracle.weblogic.domain.ManagedServer;
|
22 | 22 | import oracle.weblogic.domain.Model;
|
23 | 23 | import oracle.weblogic.domain.ServerPod;
|
| 24 | +import oracle.weblogic.kubernetes.actions.impl.OperatorParams; |
24 | 25 | import oracle.weblogic.kubernetes.actions.impl.primitive.HelmParams;
|
25 | 26 | import oracle.weblogic.kubernetes.annotations.IntegrationTest;
|
26 | 27 | import oracle.weblogic.kubernetes.annotations.Namespaces;
|
|
40 | 41 | import static oracle.weblogic.kubernetes.actions.TestActions.getPodLog;
|
41 | 42 | import static oracle.weblogic.kubernetes.actions.TestActions.uninstallOperator;
|
42 | 43 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodInitializing;
|
| 44 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReady; |
43 | 45 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists;
|
44 | 46 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createDomainAndVerify;
|
45 | 47 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createOcirRepoSecret;
|
46 | 48 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createSecretWithUsernamePassword;
|
47 | 49 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.dockerLoginAndPushImageToRegistry;
|
48 | 50 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyOperator;
|
49 | 51 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.setPodAntiAffinity;
|
| 52 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.upgradeAndVerifyOperator; |
50 | 53 | import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
|
51 | 54 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
52 | 55 | import static org.junit.jupiter.api.Assertions.assertNotNull;
|
@@ -119,10 +122,17 @@ public static void initAll(@Namespaces(5) List<String> namespaces) {
|
119 | 122 |
|
120 | 123 | // install and verify operator
|
121 | 124 | logger.info("Installing and verifying operator");
|
| 125 | + |
122 | 126 | opHelmParams = installAndVerifyOperator(opNamespace,
|
123 | 127 | domain1Namespace, domain2Namespace,
|
124 | 128 | domain3Namespace, domain4Namespace);
|
125 | 129 |
|
| 130 | + // operator chart values to override |
| 131 | + OperatorParams opParams = new OperatorParams() |
| 132 | + .helmParams(opHelmParams) |
| 133 | + .javaLoggingLevel(("FINE")); |
| 134 | + assertTrue(upgradeAndVerifyOperator(opNamespace, opParams), |
| 135 | + "Failed to upgrade operator to FINE logging leve"); |
126 | 136 | }
|
127 | 137 |
|
128 | 138 | private static void createSecrets(String domainNamespace) {
|
@@ -168,18 +178,42 @@ public void testDomainInitContainer() {
|
168 | 178 | "can't start or verify domain in namespace " + domain1Namespace);
|
169 | 179 |
|
170 | 180 | //check if init container got executed in the server pods
|
171 |
| - assertTrue(assertDoesNotThrow(() -> getPodLog(domain1Uid + "-admin-server", domain1Namespace,"busybox") |
172 |
| - .contains("Hi from Domain"), |
173 |
| - "failed to init busybox container command for admin server")); |
174 |
| - assertTrue(assertDoesNotThrow(() -> getPodLog(domain1Uid + "-managed-server1", domain1Namespace,"busybox") |
175 |
| - .contains("Hi from Domain"), |
176 |
| - "failed to init busybox container command for managed server1")); |
177 |
| - assertTrue(assertDoesNotThrow(() -> getPodLog(domain1Uid + "-managed-server2", domain1Namespace,"busybox") |
178 |
| - .contains("Hi from Domain"), |
179 |
| - "failed to init busybox container command for managed server2")); |
| 181 | + assertTrue(checkPodLogContainMsg(domain1Uid + "-admin-server",domain1Namespace, |
| 182 | + domain1Uid,"Hi from Domain"), |
| 183 | + "failed to init busybox container command for admin server"); |
| 184 | + assertTrue(checkPodLogContainMsg(domain1Uid + "-managed-server1",domain1Namespace, |
| 185 | + domain1Uid, "Hi from Domain"), |
| 186 | + "failed to init busybox container command for managed server1"); |
| 187 | + assertTrue(checkPodLogContainMsg(domain1Uid + "-managed-server2",domain1Namespace, |
| 188 | + domain1Uid,"Hi from Domain"), |
| 189 | + "failed to init busybox container command for managed server2"); |
180 | 190 |
|
181 | 191 | }
|
182 | 192 |
|
| 193 | + private boolean checkPodLogContainMsg(String podName, String podNamespace, String domainUid, String msg) { |
| 194 | + String podLog = null; |
| 195 | + try { |
| 196 | + // check that pod is ready in the domain namespace |
| 197 | + logger.info("Checking that pod {0} exists in namespace {1}", |
| 198 | + podName, podNamespace); |
| 199 | + checkPodReady(podName, domainUid, podNamespace); |
| 200 | + podLog = getPodLog(podName, podNamespace,"busybox"); |
| 201 | + } catch (Exception ex) { |
| 202 | + logger.info("Caught unexpected exception while calling getPodLog for pod " |
| 203 | + + podName |
| 204 | + + ex.getMessage() |
| 205 | + + ex.getStackTrace()); |
| 206 | + return false; |
| 207 | + } |
| 208 | + if (podLog != null) { |
| 209 | + logger.info("PodLog " + podLog); |
| 210 | + return podLog.contains(msg); |
| 211 | + } else { |
| 212 | + logger.info("getPodLog returns null , can't retrieve pod's log for " + podName); |
| 213 | + return false; |
| 214 | + } |
| 215 | + } |
| 216 | + |
183 | 217 | /**
|
184 | 218 | * Add initContainers to adminServer and verify the admin server pod executes initContainer command
|
185 | 219 | * and starts the admin server pod.
|
|
0 commit comments