|
11 | 11 | import io.kubernetes.client.custom.V1Patch; |
12 | 12 | import oracle.weblogic.domain.Domain; |
13 | 13 | import oracle.weblogic.kubernetes.actions.impl.primitive.Command; |
| 14 | +import oracle.weblogic.kubernetes.actions.impl.primitive.Kubernetes; |
14 | 15 | import oracle.weblogic.kubernetes.annotations.IntegrationTest; |
15 | 16 | import oracle.weblogic.kubernetes.annotations.Namespaces; |
16 | 17 | import oracle.weblogic.kubernetes.logging.LoggingFacade; |
|
33 | 34 | import static oracle.weblogic.kubernetes.TestConstants.OCIR_SECRET_NAME; |
34 | 35 | import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR; |
35 | 36 | import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR; |
| 37 | +import static oracle.weblogic.kubernetes.actions.TestActions.getCurrentIntrospectVersion; |
36 | 38 | import static oracle.weblogic.kubernetes.actions.TestActions.patchDomainCustomResource; |
37 | 39 | import static oracle.weblogic.kubernetes.actions.impl.primitive.Command.defaultCommandParams; |
38 | 40 | import static oracle.weblogic.kubernetes.utils.CommonMiiTestUtils.verifyUpdateWebLogicCredential; |
| 41 | +import static oracle.weblogic.kubernetes.utils.CommonOperatorUtils.restartOperator; |
39 | 42 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodDeleted; |
| 43 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodExists; |
40 | 44 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createDomainAndVerify; |
41 | 45 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createMiiImageAndVerify; |
42 | 46 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createOcirRepoSecret; |
43 | 47 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createOpsswalletpasswordSecret; |
44 | 48 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createRcuAccessSecret; |
45 | 49 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createSecretWithUsernamePassword; |
46 | 50 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.dockerLoginAndPushImageToRegistry; |
| 51 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getIntrospectJobName; |
47 | 52 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyOperator; |
48 | 53 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.patchServerStartPolicy; |
49 | 54 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.updateRcuAccessSecret; |
|
54 | 59 | import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger; |
55 | 60 | import static org.awaitility.Awaitility.with; |
56 | 61 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
| 62 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
57 | 63 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
58 | 64 | import static org.junit.jupiter.api.Assertions.assertTrue; |
59 | 65 |
|
@@ -140,6 +146,10 @@ RCUSCHEMAPREFIX, dbNamespace, getNextFreePort(), dbUrl), |
140 | 146 |
|
141 | 147 | /** |
142 | 148 | * Create a basic FMW model in image domain. |
| 149 | + * Create the FMW domain with introspectVersion |
| 150 | + * After domain is created and introspector exists restart the operator. |
| 151 | + * Verify the restarted operator can find the existing introspector and wait for it to complete |
| 152 | + * rather than replacing a new introspector. |
143 | 153 | * Verify Pod is ready and service exists for both admin server and managed servers. |
144 | 154 | * Verify EM console is accessible. |
145 | 155 | */ |
@@ -213,6 +223,31 @@ public void testFmwModelInImage() { |
213 | 223 | fmwMiiImage); |
214 | 224 |
|
215 | 225 | createDomainAndVerify(domain, fmwDomainNamespace); |
| 226 | + |
| 227 | + //verify the introspector pod is created and runs |
| 228 | + logger.info("Verifying introspector pod is created, runs"); |
| 229 | + String introspectPodNameBase = getIntrospectJobName(domainUid); |
| 230 | + logger.info("Checking introspector pod exists and introspect version"); |
| 231 | + checkPodExists(introspectPodNameBase, domainUid, fmwDomainNamespace); |
| 232 | + String introspectPodName = assertDoesNotThrow(() -> Kubernetes.listPods(fmwDomainNamespace, null) |
| 233 | + .getItems().get(0).getMetadata().getName(), |
| 234 | + String.format("Get intrspector pod name failed with ApiException in namespace %s", fmwDomainNamespace)); |
| 235 | + String introspectVersion1 = |
| 236 | + assertDoesNotThrow(() -> getCurrentIntrospectVersion(domainUid, fmwDomainNamespace)); |
| 237 | + logger.info("Before restarting operator introspector pod name is: {0}, introspectVersion is: {1}", |
| 238 | + introspectPodName, introspectVersion1); |
| 239 | + |
| 240 | + logger.info("Restarting operator in the namespace: " + opNamespace); |
| 241 | + restartOperator(opNamespace); |
| 242 | + //verify the exact same introspector pod exists and Version does not change |
| 243 | + logger.info("Checking the exact same introspector pod {0} exists in the namespace {1}", |
| 244 | + introspectPodName, fmwDomainNamespace); |
| 245 | + checkPodExists(introspectPodName, domainUid, fmwDomainNamespace); |
| 246 | + String introspectVersion2 = |
| 247 | + assertDoesNotThrow(() -> getCurrentIntrospectVersion(domainUid, fmwDomainNamespace)); |
| 248 | + logger.info("After operator restart introspectVersion is: " + introspectVersion2); |
| 249 | + assertEquals(introspectVersion1, introspectVersion2, "introspectVersion changes after operator restart"); |
| 250 | + |
216 | 251 | verifyDomainReady(fmwDomainNamespace, domainUid, replicaCount); |
217 | 252 | } |
218 | 253 |
|
@@ -358,4 +393,5 @@ private boolean patchDomainWithWalletFileSecret(String opssWalletFileSecretName) |
358 | 393 |
|
359 | 394 | return patchDomainCustomResource(domainUid, fmwDomainNamespace, patch, V1Patch.PATCH_FORMAT_JSON_PATCH); |
360 | 395 | } |
| 396 | + |
361 | 397 | } |
0 commit comments