|
26 | 26 | import oracle.weblogic.kubernetes.logging.LoggingFacade;
|
27 | 27 | import oracle.weblogic.kubernetes.utils.ExecResult;
|
28 | 28 | import org.junit.jupiter.api.BeforeAll;
|
| 29 | +import org.junit.jupiter.api.Disabled; |
29 | 30 | import org.junit.jupiter.api.DisplayName;
|
| 31 | +import org.junit.jupiter.api.MethodOrderer; |
| 32 | +import org.junit.jupiter.api.Order; |
30 | 33 | import org.junit.jupiter.api.Test;
|
| 34 | +import org.junit.jupiter.api.TestMethodOrder; |
31 | 35 |
|
32 | 36 | import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
|
33 | 37 | import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
|
|
37 | 41 | import static oracle.weblogic.kubernetes.TestConstants.OCIR_SECRET_NAME;
|
38 | 42 | import static oracle.weblogic.kubernetes.TestConstants.WDT_BASIC_IMAGE_NAME;
|
39 | 43 | import static oracle.weblogic.kubernetes.TestConstants.WDT_BASIC_IMAGE_TAG;
|
| 44 | +import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG; |
40 | 45 | import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_SLIM;
|
41 | 46 | import static oracle.weblogic.kubernetes.actions.ActionConstants.ITTESTS_DIR;
|
42 | 47 | import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
|
|
45 | 50 | import static oracle.weblogic.kubernetes.assertions.TestAssertions.domainExists;
|
46 | 51 | import static oracle.weblogic.kubernetes.utils.ApplicationUtils.checkAppUsingHostHeader;
|
47 | 52 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists;
|
| 53 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.isWebLogicPsuPatchApplied; |
48 | 54 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
|
49 | 55 | import static oracle.weblogic.kubernetes.utils.DeployUtil.deployToClusterUsingRest;
|
| 56 | +import static oracle.weblogic.kubernetes.utils.ExecCommand.exec; |
50 | 57 | import static oracle.weblogic.kubernetes.utils.FileUtils.generateFileFromTemplate;
|
51 | 58 | import static oracle.weblogic.kubernetes.utils.ImageUtils.createOcirRepoSecret;
|
52 | 59 | import static oracle.weblogic.kubernetes.utils.IstioUtils.deployHttpIstioGatewayAndVirtualservice;
|
|
62 | 69 | import static org.junit.jupiter.api.Assertions.assertNotNull;
|
63 | 70 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
64 | 71 |
|
| 72 | + |
| 73 | +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) |
65 | 74 | @DisplayName("Verify istio enabled WebLogic domain in domainhome-in-image model")
|
66 | 75 | @IntegrationTest
|
67 | 76 | class ItIstioDomainInImage {
|
@@ -116,6 +125,7 @@ public static void initAll(@Namespaces(2) List<String> namespaces) {
|
116 | 125 | * Deploy a web application thru istio http ingress port using REST api
|
117 | 126 | * Access web application thru istio http ingress port using curl
|
118 | 127 | */
|
| 128 | + @Order(1) |
119 | 129 | @Test
|
120 | 130 | @DisplayName("Create WebLogic domainhome-in-image with istio")
|
121 | 131 | void testIstioDomainHomeInImage() {
|
@@ -223,6 +233,52 @@ void testIstioDomainHomeInImage() {
|
223 | 233 | logger.info("Application Access URL {0}", url);
|
224 | 234 | boolean checkApp = checkAppUsingHostHeader(url, domainNamespace + ".org");
|
225 | 235 | assertTrue(checkApp, "Failed to access WebLogic application");
|
| 236 | + |
| 237 | + } |
| 238 | + |
| 239 | + /** |
| 240 | + * Verify that Security Warning Tool does not detect any security warning |
| 241 | + * messages on console. |
| 242 | + * Ref https://jira.oraclecorp.com/jira/browse/OWLS-92319 |
| 243 | + * However due to WDT issue, Security warning (related to minimum umask) |
| 244 | + * are reported in Console. |
| 245 | + */ |
| 246 | + |
| 247 | + @Test |
| 248 | + @Order(2) |
| 249 | + @Disabled("Disable test based on issues found reported OWLS-92319") |
| 250 | + @DisplayName("Verify the Security Warning in domain in image") |
| 251 | + void testVerifySecurityWarnings() { |
| 252 | + |
| 253 | + int istioIngressPort = getIstioHttpIngressPort(); |
| 254 | + |
| 255 | + logger.info("Istio Ingress Port is {0}", istioIngressPort); |
| 256 | + if (isWebLogicPsuPatchApplied()) { |
| 257 | + String curlCmd2 = "curl -j -sk --show-error --noproxy '*' " |
| 258 | + + " -H 'Host: " + domainNamespace + ".org'" |
| 259 | + + " --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT |
| 260 | + + " --url http://" + K8S_NODEPORT_HOST + ":" + istioIngressPort |
| 261 | + + "/management/weblogic/latest/domainRuntime/domainSecurityRuntime?" |
| 262 | + + "link=none"; |
| 263 | + |
| 264 | + ExecResult result = null; |
| 265 | + logger.info("curl command {0}", curlCmd2); |
| 266 | + result = assertDoesNotThrow( |
| 267 | + () -> exec(curlCmd2, true)); |
| 268 | + |
| 269 | + if (result.exitValue() == 0) { |
| 270 | + logger.info("curl command returned {0}", result.toString()); |
| 271 | + assertTrue(result.stdout().contains("SecurityValidationWarnings"), |
| 272 | + "Could not access the Security Warning Tool page"); |
| 273 | + assertTrue(!result.stdout().contains("minimum of umask 027"), "umask warning check failed"); |
| 274 | + logger.info("No minimum umask warning reported"); |
| 275 | + } else { |
| 276 | + assertTrue(false, "Curl command failed to get DomainSecurityRuntime"); |
| 277 | + } |
| 278 | + } else { |
| 279 | + logger.info("Skipping Security warning check, since Security Warning tool " |
| 280 | + + " is not available in the WLS Release {0}", WEBLOGIC_IMAGE_TAG); |
| 281 | + } |
226 | 282 | }
|
227 | 283 |
|
228 | 284 | private void createDomainResource(String domainUid, String domNamespace, String adminSecretName,
|
|
0 commit comments