Skip to content

Commit fd9fc37

Browse files
marinakogmaggiehe00anpanigrrjeberhard
authored
Backport to 4.0 fixes for OWLS-103358, OWLS-106012 and mon exp update version (#3877)
* OWLS-105782 Fix how to delete system resource added eariler by configMap (#3862) * fix how to delete system resource added eariler by configMap * OWLS-103358, OWLS-106012 - fixed intermittent failures and adapted wdt3.0 changes (#3861) * fixed intermittent failures and adapted wdt3.0 changes * Updated tests to use 2.1.1 Monitoring Exporter version Co-authored-by: Maggie He <[email protected]> Co-authored-by: Antaryami Panigrahi <[email protected]> Co-authored-by: Ryan Eberhard <[email protected]>
1 parent 21b4789 commit fd9fc37

File tree

3 files changed

+89
-49
lines changed

3 files changed

+89
-49
lines changed

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

Lines changed: 84 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2022, Oracle and/or its affiliates.
1+
// Copyright (c) 2022, 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;
@@ -51,12 +51,14 @@
5151
import static oracle.weblogic.kubernetes.actions.TestActions.buildAppArchive;
5252
import static oracle.weblogic.kubernetes.actions.TestActions.createDomainCustomResource;
5353
import static oracle.weblogic.kubernetes.actions.TestActions.defaultAppParams;
54+
import static oracle.weblogic.kubernetes.actions.TestActions.deleteConfigMap;
5455
import static oracle.weblogic.kubernetes.actions.TestActions.deleteImage;
5556
import static oracle.weblogic.kubernetes.actions.TestActions.getDomainCustomResource;
5657
import static oracle.weblogic.kubernetes.actions.TestActions.getOperatorPodName;
5758
import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
5859
import static oracle.weblogic.kubernetes.actions.TestActions.imageTag;
5960
import static oracle.weblogic.kubernetes.actions.TestActions.now;
61+
import static oracle.weblogic.kubernetes.actions.impl.primitive.Kubernetes.listConfigMaps;
6062
import static oracle.weblogic.kubernetes.assertions.TestAssertions.doesDomainExist;
6163
import static oracle.weblogic.kubernetes.assertions.TestAssertions.verifyRollingRestartOccurred;
6264
import static oracle.weblogic.kubernetes.utils.AuxiliaryImageUtils.checkWDTVersion;
@@ -72,6 +74,7 @@
7274
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
7375
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.verifyConfiguredSystemResouceByPath;
7476
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.verifyConfiguredSystemResource;
77+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.withLongRetryPolicy;
7578
import static oracle.weblogic.kubernetes.utils.ConfigMapUtils.createConfigMapForDomainCreation;
7679
import static oracle.weblogic.kubernetes.utils.DomainUtils.checkDomainStatusConditionTypeExists;
7780
import static oracle.weblogic.kubernetes.utils.DomainUtils.checkDomainStatusConditionTypeHasExpectedStatus;
@@ -152,6 +155,9 @@ class ItMiiAuxiliaryImage {
152155
private static final String miiAuxiliaryImage15Tag = "image15" + MII_BASIC_IMAGE_TAG;
153156
private static final String miiAuxiliaryImage15 = MII_AUXILIARY_IMAGE_NAME + ":" + miiAuxiliaryImage15Tag;
154157

158+
private static final String miiAuxiliaryImage16Tag = "image16" + MII_BASIC_IMAGE_TAG;
159+
private static final String miiAuxiliaryImage16 = MII_AUXILIARY_IMAGE_NAME + ":" + miiAuxiliaryImage16Tag;
160+
155161
private static final String errorPathAuxiliaryImage1Tag = "errorimage1" + MII_BASIC_IMAGE_TAG;
156162
private static final String errorPathAuxiliaryImage1 = MII_AUXILIARY_IMAGE_NAME + ":" + errorPathAuxiliaryImage1Tag;
157163
private static final String errorPathAuxiliaryImage2Tag = "errorimage2" + MII_BASIC_IMAGE_TAG;
@@ -708,15 +714,13 @@ WEBLOGIC_IMAGE_TO_USE_IN_SPEC, adminSecretName, createSecretsForImageRepos(domai
708714
}
709715

710716
/**
711-
* Create a domain using auxiliary image with configMap and no model files.
712-
* Verify domain events and operator log contains the expected error message.
713-
* Add to the configMap model files.
717+
* Create a domain using auxiliary image with configMap with model files.
714718
* Verify domain is created and running.
715719
*/
716720
@Test
717-
@DisplayName("Test to create domain using auxiliary image with configMap and empty model"
718-
+ " files dir in the auxiliary image")
719-
void testCreateDomainWithConfigMapAndEmptryModelFileDir() {
721+
@DisplayName("Test to create domain using auxiliary image with configMap containing model files"
722+
+ " with empty model files dir in the auxiliary image")
723+
void testCreateDomainWithConfigMapAndEmptyModelFileDir() {
720724

721725
final String auxiliaryImagePathCustom = "/customauxiliary";
722726
String domainUid = "testdomain8";
@@ -733,40 +737,92 @@ void testCreateDomainWithConfigMapAndEmptryModelFileDir() {
733737
.wdtModelHome(auxiliaryImagePathCustom + "/models");
734738
createAndPushAuxiliaryImage(MII_AUXILIARY_IMAGE_NAME,miiAuxiliaryImage12Tag, witParams);
735739

736-
String configMapName = "modelfiles-cm";
737-
logger.info("Create ConfigMap {0} in namespace {1} with WDT models {3} and {4}",
738-
configMapName, domainNamespace, MII_BASIC_WDT_MODEL_FILE, "/multi-model-one-ds.20.yaml");
739-
740740
//create empty configMap with no models files and verify that domain creation failed.
741741
List<Path> cmFiles = new ArrayList<>();
742742

743+
String configMapName1 = "modelfiles1-cm";
744+
745+
//add model files to configmap and verify domain is running
746+
cmFiles.add(
747+
Paths.get(MODEL_DIR + "/" + MII_BASIC_WDT_MODEL_FILE));
748+
cmFiles.add(Paths.get(MODEL_DIR + "/multi-model-one-ds.20.yaml"));
743749
assertDoesNotThrow(
744750
() -> createConfigMapForDomainCreation(
745-
configMapName, cmFiles, domainNamespace, this.getClass().getSimpleName()),
751+
configMapName1, cmFiles, domainNamespace, this.getClass().getSimpleName()),
746752
"Create configmap for domain creation failed");
747-
OffsetDateTime timestamp = now();
748753

749754
// create domain custom resource using auxiliary image
750755
logger.info("Creating domain custom resource with domainUid {0} and auxiliary image {1}",
751756
domainUid, miiAuxiliaryImage12);
752-
final DomainResource domainCR = createDomainResourceWithAuxiliaryImage(domainUid, domainNamespace,
757+
DomainResource domainCR1 = createDomainResourceWithAuxiliaryImage(domainUid, domainNamespace,
753758
WEBLOGIC_IMAGE_TO_USE_IN_SPEC, adminSecretName, createSecretsForImageRepos(domainNamespace),
754759
encryptionSecretName, replicaCount, auxiliaryImagePathCustom,
755760
miiAuxiliaryImage12);
761+
assertNotNull(domainCR1, "failed to create domain resource");
762+
domainCR1.spec().configuration().model().configMap(configMapName1);
763+
createDomainAndVerify(domainUid, domainCR1, domainNamespace,
764+
adminServerPodName, managedServerPrefix, replicaCount);
765+
}
766+
767+
/**
768+
* Create a domain using auxiliary image with empty configMap and no model files.
769+
* Verify domain events and operator log contains the expected error message from WDT tool.
770+
* WDT Create Primordial Domain Failed.
771+
*/
772+
@Test
773+
@DisplayName("Test to create domain using auxiliary image with "
774+
+ "empty configMap with no models files and verify that domain creation failed")
775+
void testCreateDomainWithEmptyConfigMapWithNoModelFiles() {
776+
777+
final String auxiliaryImagePathCustom = "/customauxiliary";
778+
String domainUid = "testdomain9";
779+
String adminServerPodName = domainUid + "-admin-server";
780+
String managedServerPrefix = domainUid + "-managed-server";
781+
List<String> archiveList = Collections.singletonList(ARCHIVE_DIR + "/" + MII_BASIC_APP_NAME + ".zip");
782+
783+
WitParams witParams =
784+
new WitParams()
785+
.modelImageName(MII_AUXILIARY_IMAGE_NAME)
786+
.modelImageTag(miiAuxiliaryImage16Tag)
787+
.wdtHome(auxiliaryImagePathCustom)
788+
.modelArchiveFiles(archiveList)
789+
.wdtModelHome(auxiliaryImagePathCustom + "/models");
790+
createAndPushAuxiliaryImage(MII_AUXILIARY_IMAGE_NAME,miiAuxiliaryImage16Tag, witParams);
791+
792+
String configMapName = "modelfiles-cm";
793+
logger.info("Create ConfigMap {0} in namespace {1} with WDT models {3} and {4}",
794+
configMapName, domainNamespace, MII_BASIC_WDT_MODEL_FILE, "/multi-model-one-ds.20.yaml");
795+
796+
//create empty configMap with no models files and verify that domain creation failed.
797+
List<Path> cmFiles = new ArrayList<>();
798+
799+
assertDoesNotThrow(
800+
() -> createConfigMapForDomainCreation(
801+
configMapName, cmFiles, domainNamespace, this.getClass().getSimpleName()),
802+
"Create configmap for domain creation failed");
803+
OffsetDateTime timestamp = now();
804+
805+
// create domain custom resource using auxiliary image
806+
logger.info("Creating domain custom resource with domainUid {0} and auxiliary image {1}",
807+
domainUid, miiAuxiliaryImage16);
808+
final DomainResource domainCR = createDomainResourceWithAuxiliaryImage(domainUid, domainNamespace,
809+
WEBLOGIC_IMAGE_TO_USE_IN_SPEC, adminSecretName, createSecretsForImageRepos(domainNamespace),
810+
encryptionSecretName, replicaCount, auxiliaryImagePathCustom,
811+
miiAuxiliaryImage16);
756812
assertNotNull(domainCR, "failed to create domain resource");
757813
domainCR.spec().configuration().model().configMap(configMapName);
758814
// create domain and verify it is failed
759815
logger.info("Creating domain custom resource for domainUid {0} in namespace {1}",
760-
domainUid, domainNamespace);
816+
domainUid, domainNamespace);
761817
assertDoesNotThrow(() -> createDomainCustomResource(domainCR),
762-
String.format("Create domain custom resource failed with ApiException for %s in namespace %s",
763-
domainUid, domainNamespace));
818+
String.format("Create domain custom resource failed with ApiException for %s in namespace %s",
819+
domainUid, domainNamespace));
764820
// check the introspector pod log contains the expected error message
765-
String expectedErrorMsg = "createDomain failed to find a model file in archive";
821+
String expectedErrorMsg = "Model in Image: WDT Create Primordial Domain Failed";
766822

767823
// check the domain event contains the expected error message
768824
checkDomainEventContainsExpectedMsg(opNamespace, domainNamespace, domainUid, DOMAIN_FAILED,
769-
"Warning", timestamp, expectedErrorMsg);
825+
"Warning", timestamp, expectedErrorMsg);
770826

771827
// check the operator pod log contains the expected error message
772828
checkPodLogContainsString(opNamespace, operatorPodName, expectedErrorMsg);
@@ -779,30 +835,15 @@ WEBLOGIC_IMAGE_TO_USE_IN_SPEC, adminSecretName, createSecretsForImageRepos(domai
779835
checkServiceDoesNotExist(managedServerPrefix + i, domainNamespace);
780836
}
781837

782-
// delete domain3
838+
// delete domain9
783839
deleteDomainResource(domainNamespace, domainUid);
784-
String configMapName1 = "modelfiles1-cm";
785-
786-
//add model files to configmap and verify domain is running
787-
cmFiles.add(
788-
Paths.get(MODEL_DIR + "/" + MII_BASIC_WDT_MODEL_FILE));
789-
cmFiles.add(Paths.get(MODEL_DIR + "/multi-model-one-ds.20.yaml"));
790-
assertDoesNotThrow(
791-
() -> createConfigMapForDomainCreation(
792-
configMapName1, cmFiles, domainNamespace, this.getClass().getSimpleName()),
793-
"Create configmap for domain creation failed");
794-
795-
// create domain custom resource using auxiliary image
796-
logger.info("Creating domain custom resource with domainUid {0} and auxiliary image {1}",
797-
domainUid, miiAuxiliaryImage12);
798-
DomainResource domainCR1 = createDomainResourceWithAuxiliaryImage(domainUid, domainNamespace,
799-
WEBLOGIC_IMAGE_TO_USE_IN_SPEC, adminSecretName, createSecretsForImageRepos(domainNamespace),
800-
encryptionSecretName, replicaCount, auxiliaryImagePathCustom,
801-
miiAuxiliaryImage12);
802-
assertNotNull(domainCR1, "failed to create domain resource");
803-
domainCR1.spec().configuration().model().configMap(configMapName1);
804-
createDomainAndVerify(domainUid, domainCR1, domainNamespace,
805-
adminServerPodName, managedServerPrefix, replicaCount);
840+
deleteConfigMap(configMapName, domainNamespace);
841+
testUntil(
842+
withLongRetryPolicy,
843+
() -> listConfigMaps(domainNamespace).getItems().stream().noneMatch((cm)
844+
-> (cm.getMetadata().getName().equals(configMapName))),
845+
logger,
846+
"configmap {0} to be deleted.", configMapName);
806847
}
807848

808849
/**
@@ -1346,6 +1387,7 @@ public void tearDownAll() {
13461387
deleteImage(miiAuxiliaryImage13);
13471388
deleteImage(miiAuxiliaryImage14);
13481389
deleteImage(miiAuxiliaryImage15);
1390+
deleteImage(miiAuxiliaryImage16);
13491391
deleteImage(errorPathAuxiliaryImage1);
13501392
deleteImage(errorPathAuxiliaryImage2);
13511393
deleteImage(errorPathAuxiliaryImage3);

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

Lines changed: 2 additions & 2 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;
@@ -276,7 +276,7 @@ public interface TestConstants {
276276

277277
//monitoring constants
278278
public static final String MONITORING_EXPORTER_WEBAPP_VERSION =
279-
getNonEmptySystemProperty("wko.it.monitoring.exporter.webapp.version", "2.1.0");
279+
getNonEmptySystemProperty("wko.it.monitoring.exporter.webapp.version", "2.1.1");
280280
public static final String MONITORING_EXPORTER_BRANCH =
281281
getNonEmptySystemProperty("wko.it.monitoring.exporter.branch", "main");
282282
public static final String PROMETHEUS_CHART_VERSION =

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,13 @@ public class MonitoringUtils {
126126
public static void downloadMonitoringExporterApp(String configFile, String applicationDir) {
127127
//version of wls-exporter.war published in https://github.com/oracle/weblogic-monitoring-exporter/releases/
128128
String monitoringExporterRelease = MONITORING_EXPORTER_WEBAPP_VERSION;
129-
String monitoringExporterWebAppScriptVersion = monitoringExporterRelease.substring(0,
130-
monitoringExporterRelease.length() - 2);
131129
String curlDownloadCmd = String.format("cd %s && "
132-
+ "curl -O -L -k https://github.com/oracle/weblogic-monitoring-exporter/releases/download/v%s/get%s.sh",
130+
+ "curl -O -L -k https://github.com/oracle/weblogic-monitoring-exporter/releases/download/v%s/get_v%s.sh",
133131
applicationDir,
134132
monitoringExporterRelease,
135-
monitoringExporterWebAppScriptVersion);
133+
monitoringExporterRelease);
136134
String monitoringExporterBuildFile = String.format(
137-
"%s/get%s.sh", applicationDir, monitoringExporterWebAppScriptVersion);
135+
"%s/get_v%s.sh", applicationDir, monitoringExporterRelease);
138136
logger.info("execute command a monitoring exporter curl command {0} ", curlDownloadCmd);
139137
assertTrue(Command
140138
.withParams(new CommandParams()

0 commit comments

Comments
 (0)