-
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
Conversation
… seedup test execution in parallel
What is the "Cm" in ItMiiWlsCmSamples? |
Despite the title of your PR, you do seem to have updated all of the files with the new name :) |
@@ -0,0 +1,325 @@ | |||
// Copyright (c) 2020, 2021, Oracle and/or its affiliates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
/** | ||
* Tests to verify MII sample. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Tests to verify MII sample. | |
* Tests to verify MII sample using Auxiliary Image. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
@@ -0,0 +1,385 @@ | |||
// Copyright (c) 2020, 2021, Oracle and/or its affiliates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
} | ||
} | ||
|
||
private static void assertImageExistsAndPushIfNeeded() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is duplicated code in all three test classes, can you move them out of the It class and make calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is not the only duplicate code. It looks like constants, DomainType, initAll, exectTest*, callFmw*, have all bean duplicated.
Suggestion: create one class that contains the complete implementation and call it ITMiiSampleHelper or somesuch, then create four very similar small test suite classes 'ItMIISample[WLS|JRF][Main|Aux]Image' that (a) set a modal value on the helper class to change its behavior between WLS|JRF and Main|Aux, and (b) call the helper tests. The only difference between the four need only be description text, class name, and the setting of the modal...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty nice. Just a little more to go in order to complete the refactoring: in my opinion, there's significant remaining duplicate code between the four tests' 'init' and 'tearDown' methods. These can be simplified to invoke a 'universal' init and tearDown in the new helper class. Once this duplicate code is factored out, then most of the constants and imports in the four tests no longer need to be defined (they can be local to the helper).
Also, you can add a auxiliaryImageEnabled()
method that returns true
or false
- and use it to replace repeat usage of String useAuxiliaryImage = (getImageType().equalsIgnoreCase(ImageType.AUX.toString())) ? "true" : "false";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I have some remaining minor comments - up to you if you want to follow up on them.
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Outdated
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ItMiiSampleHelper.java
Show resolved
Hide resolved
integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiSampleWlsMain.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
General comment: Still approved, but note that the review comments state that you've made the suggested remaining minor changes. The problem is that I don't see them. Perhaps a forgotten push? |
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 comment
The 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.
Jenkins job with latest changes:
all four test suite classes passed by running itself
https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/5727 (ItMiiSampleWlsAux)
https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/5720 (ItMiiSampleWlsMain)
https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/5721 (ItMiiSampleFmwAux)
https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/5722 (ItMiiSampleFmwMain)
Parallel run
https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/5728 (parallel)
https://build.weblogick8s.org:8443/job/weblogic-kubernetes-operator-kind-new/5742 (parallel)