Skip to content

Commit eff284d

Browse files
authored
Fix for tests in failures in OLCNE environment (#2524)
* Fix for tests in failures in OLCNE environment
1 parent 26376d9 commit eff284d

File tree

11 files changed

+93
-35
lines changed

11 files changed

+93
-35
lines changed

integration-tests/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,5 +304,46 @@
304304
</includes-failsafe>
305305
</properties>
306306
</profile>
307+
<profile>
308+
<id>wko-olcne-cert</id>
309+
<properties>
310+
<skipITs>false</skipITs>
311+
<includes-failsafe>
312+
**/ItCoherenceTests,
313+
**/ItConfigDistributionStrategy,
314+
**/ItCrossDomainTransaction,
315+
**/ItElasticLogging,
316+
**/ItElasticLoggingFluentd,
317+
**/ItExternalRmiTunneling,
318+
**/ItInitContainers,
319+
**/ItIntrospectVersion,
320+
**/ItIstioCrossDomainTransaction,
321+
**/ItIstioDomainInImage,
322+
**/ItIstioDomainInPV,
323+
**/ItIstioMiiDomain,
324+
**/ItIstioTwoDomainsInImage,
325+
**/ItKubernetesEvents,
326+
**/ItManageNameSpace,
327+
**/ItMiiDomain,
328+
**/ItMiiDomainModelInPV,
329+
**/ItMiiDynamicUpdate,
330+
**/ItMiiMultiModel,
331+
**/ItMiiSample,
332+
**/ItMiiUpdateDomainConfig,
333+
**/ItMonitoringExporter,
334+
**/ItOperatorRestart,
335+
**/ItParameterizedDomain,
336+
**/ItPodTemplates,
337+
**/ItPodsRestart,
338+
**/ItPodsShutdownOption,
339+
**/ItProductionSecureMode,
340+
**/ItWlsSamples,
341+
**/ItServerStartPolicy,
342+
**/ItSessionMigration,
343+
**/ItSystemResOverrides,
344+
**/ItUsabilityOperatorHelmChart
345+
</includes-failsafe>
346+
</properties>
347+
</profile>
307348
</profiles>
308349
</project>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ private static void createDomainCrAndVerify(String adminSecretName,
425425
.model(new Model()
426426
.domainType("WLS")
427427
.runtimeEncryptionSecret(encryptionSecretName))
428-
.introspectorJobActiveDeadlineSeconds(300L)));
428+
.introspectorJobActiveDeadlineSeconds(600L)));
429429
setPodAntiAffinity(domain);
430430
// create domain using model in image
431431
logger.info("Create model in image domain {0} in namespace {1} using docker image {2}",

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
5656
import static oracle.weblogic.kubernetes.actions.TestActions.scaleClusterWithRestApi;
5757
import static oracle.weblogic.kubernetes.actions.TestActions.uninstallOperator;
58+
import static oracle.weblogic.kubernetes.utils.CleanupUtil.deleteNamespacedArtifacts;
5859
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkPodReadyAndServiceExists;
5960
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.scaleAndVerifyCluster;
6061
import static oracle.weblogic.kubernetes.utils.DomainUtils.createDomainAndVerify;
@@ -100,6 +101,8 @@ class ItManageNameSpace {
100101
private static LoggingFacade logger = null;
101102
private static String miiImage = MII_BASIC_IMAGE_NAME + ":" + MII_BASIC_IMAGE_TAG;
102103

104+
List<String> namespacesToClean = new ArrayList<>();
105+
103106
/**
104107
* Get namespaces for operator, domain.
105108
*
@@ -144,23 +147,26 @@ public void tearDownAll() {
144147
logger.info("Delete domain1test custom resource in namespace {0}", "test-" + domainNamespaces[0]);
145148
deleteDomainCustomResource(domainsUid[0] + "test", "test-" + domainNamespaces[0]);
146149
logger.info("Deleted Domain Custom Resource " + domainsUid[0] + "test from test-" + domainNamespaces[0]);
147-
150+
148151
logger.info("Delete domain2test custom resource in namespace {0}", "test-" + domainNamespaces[1]);
149152
deleteDomainCustomResource(domainsUid[1] + "test", "test-" + domainNamespaces[1]);
150153
logger.info("Deleted Domain Custom Resource " + domainsUid[1] + "test from test-" + domainNamespaces[1]);
151-
154+
152155
logger.info("Delete weblogic custom resource in namespace {0}", "weblogic" + domainNamespaces[1]);
153156
deleteDomainCustomResource("weblogic", "weblogic" + domainNamespaces[1]);
154157
logger.info("Deleted Domain Custom Resource weblogic from weblogic" + domainNamespaces[1]);
155158
} finally {
156159
deleteSecrets("default");
157160
deleteSecrets("atest-" + domainNamespaces[0]);
158-
159161
deleteNamespace("atest-" + domainNamespaces[0]);
160162
//delete operator
161163
for (HelmParams helmParam : opHelmParams) {
162164
uninstallOperator(helmParam);
163165
}
166+
for (var namespace : namespacesToClean) {
167+
deleteNamespacedArtifacts(namespace);
168+
deleteNamespace(namespace);
169+
}
164170
}
165171
}
166172

@@ -200,6 +206,10 @@ void testNameSpaceManageByRegularExpression() {
200206
assertDoesNotThrow(() -> Kubernetes.createNamespace(manageByExp2NS));
201207
assertDoesNotThrow(() -> Kubernetes.createNamespace(manageByExp3NS));
202208

209+
namespacesToClean.add(manageByExp1NS);
210+
namespacesToClean.add(manageByExp2NS);
211+
namespacesToClean.add(manageByExp3NS);
212+
203213
opHelmParams[1] = installAndVerifyOperatorCanManageDomainBySelector(managedByExpDomains,unmanagedByExpDomains,
204214
"RegExp","^test",
205215
opNamespaces[1], null);
@@ -214,6 +224,7 @@ void testNameSpaceManageByRegularExpression() {
214224
//upgrade operator to manage domains with Labeled namespaces
215225
int externalRestHttpsPort = getServiceNodePort(opNamespaces[1], "external-weblogic-operator-svc");
216226
assertDoesNotThrow(() -> createNamespace(manageByLabelNS));
227+
namespacesToClean.add(manageByLabelNS);
217228
Map<String, String> labels = new HashMap<>();
218229
labels.put("mytest", "weblogic2");
219230
setLabelToNamespace(manageByLabelNS, labels);
@@ -290,6 +301,7 @@ void testNameSpaceManagedByLabelSelector() {
290301

291302
//upgrade operator1 to replace managing domains using RegExp namespaces
292303
assertDoesNotThrow(() -> createNamespace(manageByExpDomainNS));
304+
namespacesToClean.add(manageByExpDomainNS);
293305
int externalRestHttpsPort = getServiceNodePort(opNamespaces[0], "external-weblogic-operator-svc");
294306
//set helm params to use domainNamespaceSelectionStrategy=RegExp for namespaces names started with weblogic
295307
OperatorParams opParams = new OperatorParams()
@@ -332,6 +344,7 @@ void testNameSpaceWithOperatorRbacFalse() {
332344
String manageByLabelDomainNS = domainNamespaces[0] + "test4";
333345
String manageByLabelDomainUid = domainsUid[0] + "test4";
334346
assertDoesNotThrow(() -> createNamespace(manageByLabelDomainNS));
347+
namespacesToClean.add(manageByLabelDomainNS);
335348
opHelmParams[2] = installAndVerifyOperator(OPERATOR_RELEASE_NAME,
336349
opNamespaces[3], "LabelSelector",
337350
"mytest4", false).getHelmParams();
@@ -521,7 +534,8 @@ private Domain createDomainResource(String domainNamespace, String domainUid) {
521534
.configuration(new Configuration()
522535
.model(new Model()
523536
.domainType(WLS_DOMAIN_TYPE)
524-
.runtimeEncryptionSecret(encryptionSecretName))));
537+
.runtimeEncryptionSecret(encryptionSecretName))
538+
.introspectorJobActiveDeadlineSeconds(600L)));
525539
setPodAntiAffinity(domain);
526540
return domain;
527541
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,9 @@ void testLivenessProbe() {
547547
true, "/bin/sh", "-c", destLocation + " " + serverName),
548548
String.format("Failed to execute script %s in pod %s namespace %s", destLocation,
549549
serverName, domainNamespace));
550+
assertTrue(execResult.exitValue() == 0,
551+
String.format("Failed to execute kill server inside pod, stderr %s stdout %s", destLocation,
552+
execResult.stderr(), execResult.stdout()));
550553
logger.info("Command executed to kill server inside pod, exit value {0}, stdout {1}, stderr {2}",
551554
execResult.exitValue(), execResult.stdout(), execResult.stderr());
552555

@@ -912,6 +915,7 @@ private static Domain createMiiDomainWithMultiClusters(String domainUid, String
912915
.nodePort(0))))
913916
.clusters(clusterList)
914917
.configuration(new Configuration()
918+
.introspectorJobActiveDeadlineSeconds(300L)
915919
.model(new Model()
916920
.domainType(WLS_DOMAIN_TYPE)
917921
.runtimeEncryptionSecret(encryptionSecretName))));
@@ -1079,7 +1083,9 @@ private static Domain createDomainOnPvUsingWdt(String domainNamespace) {
10791083
.addClustersItem(new Cluster() //cluster
10801084
.clusterName(clusterName)
10811085
.replicas(replicaCount)
1082-
.serverStartState("RUNNING")));
1086+
.serverStartState("RUNNING"))
1087+
.configuration(new Configuration()
1088+
.introspectorJobActiveDeadlineSeconds(300L)));
10831089
setPodAntiAffinity(domain);
10841090
// verify the domain custom resource is created
10851091
createDomainAndVerify(domain, domainNamespace);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ private Domain buildDomainResource(Shutdown[] shutDownObject) {
303303
.serverStartState("RUNNING")
304304
)
305305
.configuration(new Configuration()
306+
.introspectorJobActiveDeadlineSeconds(300L)
306307
.model(new Model()
307308
.configMap(cmName)
308309
.domainType(WLS_DOMAIN_TYPE)

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,9 @@ void testSameSessionStickinessUsingVoyager() {
222222
for (int i = 0; i < maxRetry; i++) {
223223
hostNames =
224224
installVoyagerIngressAndVerify(domainUid, domainNamespace, ingressName, clusterNameMsPortMap);
225-
226225
if (hostNames != null && !hostNames.isEmpty()) {
227226
break;
228227
}
229-
230228
try {
231229
// sometimes the ingress may not be ready even the condition check is ready, sleep a little bit
232230
Thread.sleep(1000);
@@ -300,14 +298,14 @@ void testSameSessionStickinessinOKD() {
300298
// create route for cluster service
301299
String ingressHost = createRouteForOKD(serviceName, domainNamespace);
302300

303-
// Since the app seems to take a bit longer to be available,
301+
// Since the app seems to take a bit longer to be available,
304302
// checking if the app is running by executing the curl command
305-
String curlString =
306-
buildCurlCommand(ingressHost, 0, SESSMIGR_APP_WAR_NAME + "/?getCounter", " -b ");
303+
String curlString
304+
= buildCurlCommand(ingressHost, 0, SESSMIGR_APP_WAR_NAME + "/?getCounter", " -b ");
307305
logger.info("Command to set HTTP request or get HTTP response {0} ", curlString);
308306
testUntil(
309-
assertDoesNotThrow(() ->
310-
() -> exec(curlString, true).stdout().contains("managed-server")),
307+
assertDoesNotThrow(()
308+
-> () -> exec(curlString, true).stdout().contains("managed-server")),
311309
logger,
312310
"Checking if app is available");
313311
// verify that two HTTP connections are sticky to the same server

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
3030
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
3131
import static oracle.weblogic.kubernetes.TestConstants.BASE_IMAGES_REPO_SECRET;
32+
import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_IMAGES_REPO;
3233
import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_VERSION;
3334
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
34-
import static oracle.weblogic.kubernetes.TestConstants.KIND_REPO;
3535
import static oracle.weblogic.kubernetes.TestConstants.PV_ROOT;
3636
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TO_USE_IN_SPEC;
3737
import static oracle.weblogic.kubernetes.actions.ActionConstants.ITTESTS_DIR;
@@ -148,9 +148,7 @@ public static void initAll(@Namespaces(5) List<String> namespaces) {
148148
void testSampleDomainInImage(String model) {
149149
String domainName = model.split(":")[1];
150150
String script = model.split(":")[0];
151-
String imageName = (KIND_REPO != null
152-
? KIND_REPO + diiImageNameBase + "_" + script + ":" + diiImageTag
153-
: diiImageNameBase + "_" + script + ":" + diiImageTag);
151+
String imageName = DOMAIN_IMAGES_REPO + diiImageNameBase + "_" + script + ":" + diiImageTag;
154152

155153
//copy the samples directory to a temporary location
156154
setupSample();
@@ -674,11 +672,11 @@ private void deleteDomainResourceAndVerify(String domainName, Path sampleBase) {
674672
}
675673

676674
private void setupLoadBalancer(Path sampleBase, String ingressType, String additionalOptions) {
677-
// run setupLoadBalancer.sh to install/uninstall ingress controller
675+
// run setupLoadBalancer.sh to install/uninstall ingress controller
678676
CommandParams params = new CommandParams().defaults();
679677
params.command("sh "
680678
+ Paths.get(sampleBase.toString(), "setupLoadBalancer.sh").toString()
681-
+ " -t " + ingressType
679+
+ " -t " + ingressType
682680
+ additionalOptions);
683681
logger.info("Run setupLoadBalancer.sh to manage {0} ingress controller", ingressType);
684682
boolean result = Command.withParams(params).execute();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public interface TestConstants {
147147
System.getProperty("java.io.tmpdir") + "/it-testsresults");
148148

149149
public static final String LOGS_DIR = RESULTS_BASE + "/diagnostics";
150-
public static final String PV_ROOT = System.getenv().getOrDefault("PV_ROOT",
150+
public static final String PV_ROOT = System.getenv().getOrDefault("PV_ROOT",
151151
RESULTS_BASE + "/pvroot");
152152
public static final String RESULTS_ROOT = RESULTS_BASE + "/workdir";
153153

@@ -271,7 +271,7 @@ public interface TestConstants {
271271
public static final String DEFAULT_EXTERNAL_REST_IDENTITY_SECRET_NAME = "weblogic-operator-external-rest-identity";
272272

273273
// Default ISTIO version is 1.7.3
274-
public static final String ISTIO_VERSION =
274+
public static final String ISTIO_VERSION =
275275
Optional.ofNullable(System.getenv("ISTIO_VERSION")).orElse("1.7.3");
276276

277277
//MySQL database constants

integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/LoggingExporter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import java.util.concurrent.Callable;
1414

1515
import io.kubernetes.client.custom.IntOrString;
16+
import io.kubernetes.client.openapi.models.V1Capabilities;
1617
import io.kubernetes.client.openapi.models.V1Container;
1718
import io.kubernetes.client.openapi.models.V1ContainerPort;
1819
import io.kubernetes.client.openapi.models.V1Deployment;
@@ -368,6 +369,9 @@ private static V1Deployment createElasticsearchDeploymentCr(LoggingExporterParam
368369
.containers(Arrays.asList(new V1Container()
369370
.name(elasticsearchName)
370371
.image(elasticsearchImage)
372+
.securityContext(new V1SecurityContext()
373+
.capabilities(new V1Capabilities()
374+
.add(Arrays.asList("SYS_CHROOT"))))
371375
.addPortsItem(new V1ContainerPort()
372376
.containerPort(new Integer(elasticsearchHttpPort)))
373377
.addPortsItem(new V1ContainerPort()

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
import static oracle.weblogic.kubernetes.utils.PatchDomainUtils.patchDomainWithNewSecretAndVerify;
100100
import static oracle.weblogic.kubernetes.utils.PersistentVolumeUtils.createfixPVCOwnerContainer;
101101
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodDoesNotExist;
102-
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodExists;
103102
import static oracle.weblogic.kubernetes.utils.PodUtils.checkPodReady;
104103
import static oracle.weblogic.kubernetes.utils.PodUtils.getExternalServicePodName;
105104
import static oracle.weblogic.kubernetes.utils.PodUtils.getPodCreationTime;
@@ -292,7 +291,7 @@ public static Domain createDomainResource(
292291
.model(new oracle.weblogic.domain.Model()
293292
.domainType("WLS")
294293
.runtimeEncryptionSecret(encryptionSecretName))
295-
.introspectorJobActiveDeadlineSeconds(300L)));
294+
.introspectorJobActiveDeadlineSeconds(600L)));
296295
for (String clusterName : clusterNames) {
297296
domain.spec()
298297
.addClustersItem(new oracle.weblogic.domain.Cluster()
@@ -839,7 +838,7 @@ public static boolean checkApplicationRuntime(
839838
expectedStatusCode);
840839
}
841840

842-
private static ExecResult readRuntimeResource(String adminSvcExtHost, String domainNamespace,
841+
private static ExecResult readRuntimeResource(String adminSvcExtHost, String domainNamespace,
843842
String adminServerPodName, String resourcePath, String callerName) {
844843
LoggingFacade logger = getLogger();
845844

@@ -1153,21 +1152,18 @@ public static void verifyIntrospectorRuns(String domainUid, String domainNamespa
11531152
LoggingFacade logger = getLogger();
11541153
logger.info("Verifying introspector pod is created, runs and deleted");
11551154
String introspectJobName = getIntrospectJobName(domainUid);
1156-
checkPodExists(introspectJobName, domainUid, domainNamespace);
1155+
checkPodReady(introspectJobName, domainUid, domainNamespace);
11571156

11581157
String labelSelector = String.format("weblogic.domainUID in (%s)", domainUid);
11591158
V1Pod introspectorPod = assertDoesNotThrow(() -> getPod(domainNamespace, labelSelector, introspectJobName),
11601159
"Could not get introspector pod");
11611160
assertTrue(introspectorPod != null && introspectorPod.getMetadata() != null,
11621161
"introspector pod or metadata is null");
1163-
try {
1164-
String introspectorLog = getPodLog(introspectorPod.getMetadata().getName(), domainNamespace);
1165-
logger.info("Introspector pod log START");
1166-
logger.info(introspectorLog);
1167-
logger.info("Introspector pod log END");
1168-
} catch (Exception ex) {
1169-
logger.info("Failed to get introspector pod log", ex);
1170-
}
1162+
String introspectorLog = assertDoesNotThrow(() -> getPodLog(introspectorPod.getMetadata().getName(),
1163+
domainNamespace), "Could not get introspector pod log");
1164+
logger.info("Introspector pod log START");
1165+
logger.info(introspectorLog);
1166+
logger.info("Introspector pod log END");
11711167
checkPodDoesNotExist(introspectJobName, domainUid, domainNamespace);
11721168
}
11731169

0 commit comments

Comments
 (0)