Skip to content

Commit f20f5b1

Browse files
authored
Fix createIngress failure in ItIntrospectVersion in OLCNE nightly run (#3822)
* remove unused createIngress method
1 parent 18fbd57 commit f20f5b1

File tree

1 file changed

+24
-36
lines changed

1 file changed

+24
-36
lines changed

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

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2020, 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2020, 2023, 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;
@@ -61,7 +61,6 @@
6161
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
6262
import static oracle.weblogic.kubernetes.TestConstants.KIND_REPO;
6363
import static oracle.weblogic.kubernetes.TestConstants.KUBERNETES_CLI;
64-
import static oracle.weblogic.kubernetes.TestConstants.OKD;
6564
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO;
6665
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME;
6766
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME_DEFAULT;
@@ -109,7 +108,6 @@
109108
import static oracle.weblogic.kubernetes.utils.K8sEvents.DOMAIN_ROLL_STARTING;
110109
import static oracle.weblogic.kubernetes.utils.K8sEvents.POD_CYCLE_STARTING;
111110
import static oracle.weblogic.kubernetes.utils.K8sEvents.checkEvent;
112-
import static oracle.weblogic.kubernetes.utils.LoadBalancerUtils.createIngressForDomainAndVerify;
113111
import static oracle.weblogic.kubernetes.utils.OKDUtils.createRouteForOKD;
114112
import static oracle.weblogic.kubernetes.utils.OperatorUtils.installAndVerifyOperator;
115113
import static oracle.weblogic.kubernetes.utils.PatchDomainUtils.patchDomainResource;
@@ -174,11 +172,8 @@ class ItIntrospectVersion {
174172
private static String wlsPassword = ADMIN_PASSWORD_DEFAULT;
175173

176174
private static String adminSvcExtHost = null;
177-
private static String clusterRouteHost = null;
178-
private static final String clusterServiceName = domainUid + "-cluster-" + cluster1Name;
179175

180176
private Map<String, OffsetDateTime> cl2podsWithTimeStamps = null;
181-
private Map<String, OffsetDateTime> cl1podsWithTimeStamps = null;
182177

183178
private static final String INTROSPECT_DOMAIN_SCRIPT = "introspectDomain.sh";
184179
private static final Path samplePath = Paths.get(ITTESTS_DIR, "../kubernetes/samples");
@@ -329,21 +324,10 @@ void testDomainIntrospectVersionNotRolling() {
329324
podStateNotChanged(adminServerPodName, domainUid, introDomainNamespace, adminPodCreationTime);
330325
for (int i = 1; i <= cluster1ReplicaCount; i++) {
331326
podStateNotChanged(cluster1ManagedServerPodNamePrefix + i,
332-
domainUid, introDomainNamespace, pods.get(i));
327+
domainUid, introDomainNamespace, pods.get(cluster1ManagedServerPodNamePrefix + i));
333328
}
334329

335-
//create ingress controller - OKD uses services exposed as routes
336-
if (!OKD) {
337-
Map<String, Integer> clusterNameMsPortMap = new HashMap<>();
338-
clusterNameMsPortMap.put(cluster1Name, managedServerPort);
339-
logger.info("Creating ingress for domain {0} in namespace {1}", domainUid, introDomainNamespace);
340-
createIngressForDomainAndVerify(domainUid, introDomainNamespace, clusterNameMsPortMap);
341-
} else {
342-
clusterRouteHost = createRouteForOKD(clusterServiceName, introDomainNamespace);
343-
}
344-
345-
List<String> managedServerNames = new ArrayList<String>();
346-
managedServerNames = new ArrayList<String>();
330+
List<String> managedServerNames = new ArrayList<>();
347331
for (int i = 1; i <= cluster1ReplicaCount + 1; i++) {
348332
managedServerNames.add(cluster1ManagedServerNameBase + i);
349333
}
@@ -465,7 +449,7 @@ void testDomainIntrospectVersionRolling() {
465449
"Getting admin server port failed"),
466450
"Updated admin server port is not equal to expected value");
467451

468-
List<String> managedServerNames = new ArrayList<String>();
452+
List<String> managedServerNames = new ArrayList<>();
469453
for (int i = 1; i <= cluster1ReplicaCount; i++) {
470454
managedServerNames.add(cluster1ManagedServerNameBase + i);
471455
}
@@ -586,7 +570,6 @@ void testCredentialChange() {
586570
checkPodReadyAndServiceExists(cluster1ManagedServerPodNamePrefix + i, domainUid, introDomainNamespace);
587571
}
588572

589-
DomainResource cr = assertDoesNotThrow(() -> getDomainCustomResource(domainUid, introDomainNamespace));
590573
if (cluster2Created) {
591574
// verify new cluster managed server pods are ready
592575
for (int i = 1; i <= cluster2ReplicaCount; i++) {
@@ -601,11 +584,11 @@ void testCredentialChange() {
601584
final boolean VALID = true;
602585
logger.info("Check that after patching current credentials are not valid and new credentials are");
603586
verifyCredentials(adminSvcExtHost, adminServerPodName, introDomainNamespace,
604-
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, !VALID);
587+
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, false);
605588
verifyCredentials(adminSvcExtHost, adminServerPodName, introDomainNamespace,
606589
ADMIN_USERNAME_PATCH, ADMIN_PASSWORD_PATCH, VALID);
607590

608-
List<String> managedServerNames = new ArrayList<String>();
591+
List<String> managedServerNames = new ArrayList<>();
609592
for (int i = 1; i <= cluster1ReplicaCount; i++) {
610593
managedServerNames.add(cluster1ManagedServerNameBase + i);
611594
}
@@ -688,7 +671,7 @@ void testCreateNewCluster() {
688671
checkPodReadyAndServiceExists(cluster2ManagedServerPodNamePrefix + i, domainUid, introDomainNamespace);
689672
}
690673

691-
List<String> managedServerNames = new ArrayList<String>();
674+
List<String> managedServerNames = new ArrayList<>();
692675
for (int i = 1; i <= cluster2ReplicaCount; i++) {
693676
managedServerNames.add(cluster2ManagedServerNameBase + i);
694677
}
@@ -725,7 +708,7 @@ void testUpdateImageName() {
725708
cluster1ManagedServerNames.add(cluster1ManagedServerNameBase + i);
726709
}
727710
// get the map with server pods and their original creation timestamps
728-
cl1podsWithTimeStamps = getPodsWithTimeStamps(introDomainNamespace, adminServerPodName,
711+
Map<String, OffsetDateTime> cl1podsWithTimeStamps = getPodsWithTimeStamps(introDomainNamespace, adminServerPodName,
729712
cluster1ManagedServerPodNamePrefix, cluster1ReplicaCount);
730713

731714
List<String> cluster2ManagedServerNames = new ArrayList<>();
@@ -753,8 +736,7 @@ void testUpdateImageName() {
753736
imageTag(imageName, imageUpdate);
754737
imageRepoLoginAndPushImageToRegistry(imageUpdate);
755738

756-
StringBuffer patchStr = null;
757-
patchStr = new StringBuffer("[{");
739+
StringBuffer patchStr = new StringBuffer("[{");
758740
patchStr.append("\"op\": \"replace\",")
759741
.append(" \"path\": \"/spec/image\",")
760742
.append("\"value\": \"")
@@ -1159,7 +1141,7 @@ private static void createDomain() {
11591141
},
11601142
logger,
11611143
"Deploying the application using Rest");
1162-
List<String> managedServerNames = new ArrayList<String>();
1144+
List<String> managedServerNames = new ArrayList<>();
11631145
for (int i = 1; i <= cluster1ReplicaCount; i++) {
11641146
managedServerNames.add(cluster1ManagedServerNameBase + i);
11651147
}
@@ -1282,7 +1264,6 @@ private void verifyIntrospectVersionLabelInPod() {
12821264
verifyIntrospectVersionLabelValue(cluster1ManagedServerPodNamePrefix + i, introspectVersion);
12831265
}
12841266

1285-
DomainResource cr = assertDoesNotThrow(() -> getDomainCustomResource(domainUid, introDomainNamespace));
12861267
if (cluster2Created) {
12871268
// verify new cluster managed server pods are ready
12881269
for (int i = 1; i <= cluster2ReplicaCount; i++) {
@@ -1299,16 +1280,23 @@ private void verifyIntrospectVersionLabelValue(String podName, String introspect
12991280
getPod(introDomainNamespace, "", podName),
13001281
"Get pod " + podName);
13011282

1302-
Map<String, String> myLabels = myPod.getMetadata().getLabels();
1283+
Map<String, String> myLabels = new HashMap<>();
1284+
if (myPod != null && myPod.getMetadata() != null) {
1285+
myLabels = myPod.getMetadata().getLabels();
1286+
}
13031287

1304-
for (Map.Entry<String, String> entry : myLabels.entrySet()) {
1305-
if (entry.getKey().equals(wlsIntroVersion)) {
1306-
logger.info("Get Spec Key:value = {0}:{1}", entry.getKey(), entry.getValue());
1307-
logger.info("Verifying weblogic.introspectVersion is set to {0}", introspectVersion);
1288+
if (myLabels != null) {
1289+
for (Map.Entry<String, String> entry : myLabels.entrySet()) {
1290+
if (entry.getKey().equals(wlsIntroVersion)) {
1291+
logger.info("Get Spec Key:value = {0}:{1}", entry.getKey(), entry.getValue());
1292+
logger.info("Verifying weblogic.introspectVersion is set to {0}", introspectVersion);
13081293

1309-
assertEquals(introspectVersion, entry.getValue(),
1310-
"Failed to set " + wlsIntroVersion + " to " + introspectVersion);
1294+
assertEquals(introspectVersion, entry.getValue(),
1295+
"Failed to set " + wlsIntroVersion + " to " + introspectVersion);
1296+
}
13111297
}
1298+
} else {
1299+
logger.info("myLabels for pod {0} in namespace {1} is null", podName, introDomainNamespace);
13121300
}
13131301
}
13141302

0 commit comments

Comments
 (0)