-
Notifications
You must be signed in to change notification settings - Fork 634
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
Feat/#502 consul integrate test #503
Conversation
…eat/#502-consul-integrate-test
Codecov Report
@@ Coverage Diff @@
## master #503 +/- ##
============================================
- Coverage 49.67% 49.65% -0.02%
Complexity 1829 1829
============================================
Files 258 258
Lines 11214 11214
Branches 1607 1607
============================================
- Hits 5570 5568 -2
- Misses 4985 4987 +2
Partials 659 659
Continue to review full report at Codecov.
|
@jiachen1120 This is a very good idea to test with a real container; however, we cannot expect all developers to use docker on their development environment. We have some repositories that depending on the external containers for testing and normally we create an extra folder called integration along with test for integration test. All unit tests will be in the test folder and they don't rely on the container and all integration test cases are in the integration folder and they rely on the container. The following is an example in light-session-4j and the integration test won't be invoked when https://github.com/networknt/light-session-4j/tree/master/redis-manager/src |
@jiachen1120 : while I agree that it is a neat idea, please be aware that developers at my client are building/testing in several APIs on Windows machines, on prem, in order to have access to certain resources. In those cases, they don't use Docker, as they don't have it on their machines. |
@stevehu Cool, I will migrate this test to an integrate folder |
@ddobrin Hey, after migrating this test to integration test folder. They would not be invoked during mvn build. They can be used just by developer to testing the framework. |
I looked at the test container project and it is very promising. It is much more convenient than our docker-compose. Good job! |
* This test is an automatic test for real consul registry and discovery by using testContainers. | ||
* Since it depends on docker so it should be disabled all the time unless it is used. | ||
*/ | ||
@Ignore |
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.
Is there a better way to enable/disable then (what I presume) is manually removing the @ Ignore flag? What is the process for running full integration tests?
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.
We can enable the test case. If you don't want to execute the integration test cases, use mvn clean package
. If you want to run all integration tests along with unit tests, then you can use mvn clean install
.
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.
Maybe we don't want to go that far in case someone wants to install the dependencies but doesn't have docker installed.. could we add a maven profile for running integration tests?
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.
Using maven profile is another option. The key point is we need to ensure that broader users can compile without the docker installed and our developers can trigger integration tests with a switch. I really have no idea which commands most developers using mvn package
or mvn install
.
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.
@stevehu Hey. I think mvn install
would be more popular to use. So I updated the pom to disable the integration test execution when using mvn install
.
In this way,mvn install
only run the unit test.
And the following commands are using for executing integration tests:
mvn verify -DskipITs=false
mvn integration-tests -DskipITs=false
mvn clean install -DskipITs=false
What do you think?
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.
I think it is a very good idea. mvn verify -DskipITs=false can execute integration tests when they are annotated as ignored?
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.
I just tested. If @ignore
annotated inside testing code. There seems no way to execute them. I think we can remove all the ignore annotation in the integration test if the default value for skipITs is true.
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.
Got it. I like the idea. We need to make sure that everything is transparent to new developers.
@jiachen1120 i'm getting failures when running the build locally.. is there something i'm missing?
|
…folder to the target folder -CURD some config files due to fix test cases (those were not configured correctly in previous versions)
-test configs will be generated either from integration folder or under test folder depends on the profile, cannot include both because file with same name will have only one copy under config directory in phase "generate-test-sources". -when run mvn clean install will as usual, when run mvn clean install -P integration-test will execute integration tests
…consul-integrate-test
This passes for me now with command |
cherry-pick 2638299 Feat/#502 consul integrate test (#503) * Fixed the scope caching error * Added dependence of container test into pom * Moved the test cases to server module * Enhanced the registry test with testContainer. * Migrate consul container test to integration folder * Reverted unnecessary change * Changed name * Disable the integration test for mvn clean install * Removed unused line * -now integration test will copy the config under its own integration folder to the target folder -CURD some config files due to fix test cases (those were not configured correctly in previous versions) * -move integration plugins to integration-test profile -test configs will be generated either from integration folder or under test folder depends on the profile, cannot include both because file with same name will have only one copy under config directory in phase "generate-test-sources". -when run mvn clean install will as usual, when run mvn clean install -P integration-test will execute integration tests * fixes the typo # Conflicts: # pom.xml
cherry-pick 26382993 Feat/#502 consul integrate test (#503) * Fixed the scope caching error * Added dependence of container test into pom * Moved the test cases to server module * Enhanced the registry test with testContainer. * Migrate consul container test to integration folder * Reverted unnecessary change * Changed name * Disable the integration test for mvn clean install * Removed unused line * -now integration test will copy the config under its own integration folder to the target folder -CURD some config files due to fix test cases (those were not configured correctly in previous versions) * -move integration plugins to integration-test profile -test configs will be generated either from integration folder or under test folder depends on the profile, cannot include both because file with same name will have only one copy under config directory in phase "generate-test-sources". -when run mvn clean install will as usual, when run mvn clean install -P integration-test will execute integration tests * fixes the typo # Conflicts: # pom.xml
* merged #503 from master to 1.6.x cherry-pick 2638299 Feat/#502 consul integrate test (#503) * Fixed the scope caching error * Added dependence of container test into pom * Moved the test cases to server module * Enhanced the registry test with testContainer. * Migrate consul container test to integration folder * Reverted unnecessary change * Changed name * Disable the integration test for mvn clean install * Removed unused line * -now integration test will copy the config under its own integration folder to the target folder -CURD some config files due to fix test cases (those were not configured correctly in previous versions) * -move integration plugins to integration-test profile -test configs will be generated either from integration folder or under test folder depends on the profile, cannot include both because file with same name will have only one copy under config directory in phase "generate-test-sources". -when run mvn clean install will as usual, when run mvn clean install -P integration-test will execute integration tests * fixes the typo # Conflicts: # pom.xml * Fix/#519 keystore fall back (#525) * Fixed the scope caching error * Fix keystore and truststore fall back * Fixed keystore and truststore fall back * Removed incorrect/unnecessary log message * Added comments * Created TlsUtil to support load keystore/truststore * Added test cases
* merged #503 from master to 1.6.x cherry-pick 2638299 Feat/#502 consul integrate test (#503) * Fixed the scope caching error * Added dependence of container test into pom * Moved the test cases to server module * Enhanced the registry test with testContainer. * Migrate consul container test to integration folder * Reverted unnecessary change * Changed name * Disable the integration test for mvn clean install * Removed unused line * -now integration test will copy the config under its own integration folder to the target folder -CURD some config files due to fix test cases (those were not configured correctly in previous versions) * -move integration plugins to integration-test profile -test configs will be generated either from integration folder or under test folder depends on the profile, cannot include both because file with same name will have only one copy under config directory in phase "generate-test-sources". -when run mvn clean install will as usual, when run mvn clean install -P integration-test will execute integration tests * fixes the typo # Conflicts: # pom.xml * Fix/#519 keystore fall back (#525) * Fixed the scope caching error * Fix keystore and truststore fall back * Fixed keystore and truststore fall back * Removed incorrect/unnecessary log message * Added comments * Created TlsUtil to support load keystore/truststore * Added test cases * - Made config module loading strategy pluggable - Added test cases * - Added comments - Added more test case * - Added more test cases * removed skip.unit.tests flag, move dup use of plugins to plugin management, try to use <skipTests> in integration profile * -revert changes, change skip.unit.tests to skipTests -based on https://issues.apache.org/jira/browse/MNG-4979, cannot override skipTests once it's set by skip.unit.tests * added missing itegration test config files, because now itegration test config will be totally sepreate from unit test configs * fixes #590 by adding client.truststore and client.keystore into server integration * - Fix consul integration test
* Fixed the scope caching error * Added dependence of container test into pom * Moved the test cases to server module * Enhanced the registry test with testContainer. * Migrate consul container test to integration folder * Reverted unnecessary change * Changed name * Disable the integration test for mvn clean install * Removed unused line * -now integration test will copy the config under its own integration folder to the target folder -CURD some config files due to fix test cases (those were not configured correctly in previous versions) * -move integration plugins to integration-test profile -test configs will be generated either from integration folder or under test folder depends on the profile, cannot include both because file with same name will have only one copy under config directory in phase "generate-test-sources". -when run mvn clean install will as usual, when run mvn clean install -P integration-test will execute integration tests * fixes the typo * update travis to jdk11
Enhance the registry test by integrate with https://www.baeldung.com/docker-test-containers, so a real consul can be established automatically when testing.
Since this integrate test depends on docker so it should be disabled all the time unless it is used.
Related issue: #502