Skip to content
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

move zkRegCenter.init() and zkRegCenter.close() to @BeforeAll and @AfterAll to make tests run faster and look similar to other tests #2378

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

TestBoost
Copy link
Contributor

Changes proposed in this pull request:

  • put zkRegCenter.init(); and zkRegCenter.close(); into the method body of @BeforeAll and @AfterAll. There are three tests in the test class OneOffJobBootstrapTest. However, these three tests are justing trying to use zkRegCenter to initialize some objects and they are not modifying zkRegCenter.
  • Besides, we searched for all the tests which contain zkRegCenter.init(); and zkRegCenter.close();. All tests in the project apache/shardingsphere-elasticjob except OneOffJobBootstrapTest put zkRegCenter.init(); and zkRegCenter.close(); into the method body of @BeforeAll and @AfterAll.
  • The test runtime can jump from 3.489 s to 2.403 s after applying the changes when run on our machine.

Copy link
Member

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • You can execute first ./mvnw spotless:apply -Pcheck -T1C. Then execute ./mvnw checkstyle:check -Pcheck -T1C to manually adjust to repair the CI.

…terall to make tests run faster and look similar to other tests
@TestBoost
Copy link
Contributor Author

Sorry for the checkstyle issues. I tried to run with ./mvnw spotless:apply -Pcheck -T1C and ./mvnw checkstyle:check -Pcheck -T1C, but it all passes. But when I checked the log, I found there is a tab in the changed test class file. I just changed it to whitespace and do not know if it works now.

@codecov-commenter
Copy link

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (a8ba448) 80.10% compared to head (98bf060) 79.61%.
Report is 23 commits behind head on master.

Files Patch % Lines
.../rdb/storage/repository/RDBJobEventRepository.java 91.04% 3 Missing and 3 partials ⚠️
.../tracing/rdb/storage/sql/SQLPropertiesFactory.java 71.42% 1 Missing and 1 partial ⚠️
...here/elasticjob/http/executor/HttpJobExecutor.java 95.45% 0 Missing and 1 partial ⚠️
...ing/rdb/config/RDBTracingStorageConfiguration.java 66.66% 0 Missing and 1 partial ⚠️
...e/type/impl/DefaultTracingStorageDatabaseType.java 0.00% 1 Missing ⚠️
.../tracing/rdb/yaml/YamlDataSourceConfiguration.java 0.00% 1 Missing ⚠️
...rdb/yaml/YamlDataSourceConfigurationConverter.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2378      +/-   ##
============================================
- Coverage     80.10%   79.61%   -0.50%     
+ Complexity     1113     1106       -7     
============================================
  Files           204      204              
  Lines          3821     3806      -15     
  Branches        445      443       -2     
============================================
- Hits           3061     3030      -31     
- Misses          570      585      +15     
- Partials        190      191       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@linghengqian linghengqian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • LGTM!

@linghengqian linghengqian merged commit 38eedb8 into apache:master Dec 14, 2023
12 checks passed
@linghengqian linghengqian added this to the 3.1.0 milestone Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants