-
Notifications
You must be signed in to change notification settings - Fork 217
Split the MiiSample classes to ItMiiWlsAuxiliaryImageSample and ItMiiFmwAuxiliaryImageSample to seedup test execution in parallel #2455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
85dcf98
e63add4
81adb6c
a69e479
80ddba9
4ba4c8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,8 +68,8 @@ public class ItMiiSampleHelper { | |
private static Map<String, String> envMap = null; | ||
private static LoggingFacade logger = null; | ||
private static boolean previousTestSuccessful = true; | ||
private static DomainType domainTypeName = null; | ||
private static ImageType imageTypeName = null; | ||
private static DomainType domainType = null; | ||
private static ImageType imageType = null; | ||
|
||
public enum DomainType { | ||
JRF, | ||
|
@@ -85,9 +85,13 @@ public enum ImageType { | |
* Install Operator. | ||
* @param namespaces list of namespaces created by the IntegrationTestWatcher by the | ||
* JUnit engine parameter resolution mechanism | ||
* @param domainTypeParam domain type names | ||
* @param imageTypeParam image type names | ||
*/ | ||
public static void initAll(List<String> namespaces) { | ||
public static void initAll(List<String> namespaces, DomainType domainTypeParam, ImageType imageTypeParam) { | ||
logger = getLogger(); | ||
ItMiiSampleHelper.domainType = domainTypeParam; | ||
ItMiiSampleHelper.imageType = imageTypeParam; | ||
// get a new unique opNamespace | ||
logger.info("Creating unique namespace for Operator"); | ||
assertNotNull(namespaces.get(0), "Namespace list is null"); | ||
|
@@ -101,9 +105,6 @@ public static void initAll(List<String> namespaces) { | |
assertNotNull(namespaces.get(2), "Namespace list is null"); | ||
traefikNamespace = namespaces.get(2); | ||
|
||
assertNotNull(domainTypeName, "DomainType name is null"); | ||
assertNotNull(imageTypeName, "ImageType name list is null"); | ||
|
||
// install and verify operator | ||
installAndVerifyOperator(opNamespace, domainNamespace); | ||
|
||
|
@@ -119,7 +120,7 @@ public static void initAll(List<String> namespaces) { | |
envMap.put("IMAGE_PULL_SECRET_NAME", OCIR_SECRET_NAME); //ocir secret | ||
envMap.put("K8S_NODEPORT_HOST", K8S_NODEPORT_HOST); | ||
envMap.put("OKD", "" + OKD); | ||
envMap.put("DO_AI", String.valueOf(auxiliaryImageEnabled())); | ||
envMap.put("DO_AI", String.valueOf(imageType == ImageType.AUX)); | ||
|
||
// kind cluster uses openjdk which is not supported by image tool | ||
String witJavaHome = System.getenv("WIT_JAVA_HOME"); | ||
|
@@ -148,7 +149,7 @@ public static void initAll(List<String> namespaces) { | |
logger.info("Docker registry secret {0} created successfully in namespace {1}", | ||
OCIR_SECRET_NAME, domainNamespace); | ||
|
||
if (domainTypeName.equals(DomainType.JRF)) { | ||
if (domainType.equals(DomainType.JRF)) { | ||
// install db for FMW test cases | ||
logger.info("Creating unique namespace for Database"); | ||
assertNotNull(namespaces.get(3), "Namespace list is null"); | ||
|
@@ -231,6 +232,7 @@ public static void execTestScriptAndAssertSuccess(DomainType domainType, | |
|
||
String outStr = errString; | ||
outStr += ", domainType=" + domainType + "\n"; | ||
outStr += ", imageType=" + imageType + "\n"; | ||
outStr += ", command=\n{\n" + command + "\n}\n"; | ||
outStr += ", stderr=\n{\n" + (result != null ? result.stderr() : "") + "\n}\n"; | ||
outStr += ", stdout=\n{\n" + (result != null ? result.stdout() : "") + "\n}\n"; | ||
|
@@ -246,12 +248,12 @@ public static void execTestScriptAndAssertSuccess(DomainType domainType, | |
* Test MII sample WLS or JRF initial use case. | ||
*/ | ||
public static void callInitialUseCase() { | ||
String imageName = (domainTypeName.equals(DomainType.WLS)) | ||
String imageName = (domainType.equals(DomainType.WLS)) | ||
? MII_SAMPLE_WLS_IMAGE_NAME_V1 : MII_SAMPLE_JRF_IMAGE_NAME_V1; | ||
previousTestSuccessful = true; | ||
envMap.put("MODEL_IMAGE_NAME", imageName); | ||
|
||
if (domainTypeName.equals(DomainType.JRF)) { | ||
if (domainType.equals(DomainType.JRF)) { | ||
String dbImageName = (KIND_REPO != null | ||
? KIND_REPO + DB_IMAGE_NAME.substring(BASE_IMAGES_REPO.length() + 1) : DB_IMAGE_NAME); | ||
String jrfBaseImageName = (KIND_REPO != null | ||
|
@@ -270,11 +272,11 @@ public static void callInitialUseCase() { | |
|
||
// run JRF use cases irrespective of WLS use cases fail/pass | ||
previousTestSuccessful = true; | ||
execTestScriptAndAssertSuccess(domainTypeName, "-db,-rcu", "DB/RCU creation failed"); | ||
execTestScriptAndAssertSuccess(domainType, "-db,-rcu", "DB/RCU creation failed"); | ||
} | ||
|
||
execTestScriptAndAssertSuccess( | ||
domainTypeName, | ||
domainType, | ||
"-initial-image,-check-image-and-push,-initial-main", | ||
"Initial use case failed" | ||
); | ||
|
@@ -286,12 +288,23 @@ public static void callInitialUseCase() { | |
public static void callUpdateUseCase(String args, | ||
String errString) { | ||
if (args.contains("update3")) { | ||
String imageName = (domainTypeName.equals(DomainType.WLS)) | ||
String imageName = (domainType.equals(DomainType.WLS)) | ||
? MII_SAMPLE_WLS_IMAGE_NAME_V2 : MII_SAMPLE_JRF_IMAGE_NAME_V2; | ||
envMap.put("MODEL_IMAGE_NAME", imageName); | ||
} | ||
|
||
execTestScriptAndAssertSuccess(domainTypeName, args, errString); | ||
execTestScriptAndAssertSuccess(domainType, args, errString); | ||
} | ||
|
||
/** | ||
* Test MII sample WLS or JRF update1 use case. | ||
*/ | ||
public static void callCheckMiiSampleSource(String args, | ||
String errString) { | ||
final String baseImageNameKey = "BASE_IMAGE_NAME"; | ||
envMap.remove(baseImageNameKey); | ||
execTestScriptAndAssertSuccess(domainType, args, errString); | ||
envMap.put(baseImageNameKey, WEBLOGIC_IMAGE_NAME); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: This looks like a refactoring issue. If, sometime in the future, the suite was changed so that this test was called from a different location and this is not fixed, then the test would potentially break the next test. The code shouldn't force WEBLOGIC_IMAGE_NAME -- instead, the code should restore the image that was originally in the envMap, similar to the original code, and it should ideally do this in a finally. |
||
} | ||
|
||
/** | ||
|
@@ -308,69 +321,12 @@ public static void tearDownAll() { | |
} | ||
|
||
// db cleanup or deletion | ||
if (domainTypeName.equals(DomainType.JRF) && envMap != null) { | ||
if (domainType.equals(DomainType.JRF) && envMap != null) { | ||
logger.info("Running samples DB cleanup"); | ||
Command.withParams(new CommandParams() | ||
.command(MII_SAMPLES_SCRIPT + " -precleandb") | ||
.env(envMap) | ||
.redirect(true)).execute(); | ||
} | ||
tbarnes-us marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
|
||
/** | ||
* Set env variables map. | ||
* @param newEnvMap a map contains env variables | ||
*/ | ||
public static void setEnvMap(Map<String, String> newEnvMap) { | ||
ItMiiSampleHelper.envMap = newEnvMap; | ||
} | ||
|
||
/** | ||
* Set domain type. | ||
* @param domainTypeName domain type name | ||
*/ | ||
public static void setDomainType(DomainType domainTypeName) { | ||
ItMiiSampleHelper.domainTypeName = domainTypeName; | ||
} | ||
|
||
/** | ||
* Set image type. | ||
* @param imageTypeName image type names | ||
*/ | ||
public static void setImageType(ImageType imageTypeName) { | ||
ItMiiSampleHelper.imageTypeName = imageTypeName; | ||
} | ||
|
||
/** | ||
* Get env variables map. | ||
* @return a map containing env variables | ||
*/ | ||
public static Map<String, String> getEnvMap() { | ||
return ItMiiSampleHelper.envMap; | ||
} | ||
|
||
/** | ||
* Get domain type. | ||
* @return domain type name | ||
*/ | ||
public static DomainType getDomainType() { | ||
return domainTypeName; | ||
} | ||
|
||
/** | ||
* Get image type. | ||
* @return image type names | ||
*/ | ||
public static ImageType getImageType() { | ||
return ItMiiSampleHelper.imageTypeName; | ||
} | ||
|
||
/** | ||
* Check whether to use auxiliary image or not. | ||
* @return true to test auxiliary image and false to test non-auxiliary image | ||
*/ | ||
public static boolean auxiliaryImageEnabled() { | ||
return (imageTypeName.equals(ImageType.AUX)) ? true : false; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.