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

Problem: integration tests CI spend a lot of time #1271

Merged
merged 11 commits into from
Dec 20, 2023

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Dec 20, 2023

Solution:

  • run in parallel using markers and job matrix

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

Summary by CodeRabbit

  • New Features

    • Integration tests now support selective execution based on test markers.
  • Tests

    • Added markers for improved test categorization and selection during the integration testing process.
  • Chores

    • Updated test workflow and scripts to accommodate new test execution strategy based on markers.

Solution:
- run in parallel using markers and job matrix
@yihuang yihuang requested a review from a team as a code owner December 20, 2023 08:09
@yihuang yihuang requested review from mmsqe and leejw51crypto and removed request for a team December 20, 2023 08:09
Copy link
Contributor

coderabbitai bot commented Dec 20, 2023

Walkthrough

The changes represent a significant evolution in the testing infrastructure, introducing a more organized and selective approach to running integration tests. The addition of test markers and the utilization of a matrix strategy allows for more granular control over test execution, enhancing the overall testing process.

Changes

File Path Change Summary
.github/workflows/test.yml Introduced a strategy section with a matrix for test categories and updated env to utilize matrix values.
Makefile Added TESTS_TO_RUN variable to facilitate the selection of specific integration tests.
integration_tests/conftest.py,
test_ibc.py,
test_ibc_rly.py,
test_ibc_rly_gas.py,
test_ibc_timeout.py,
test_ibc_update_client.py,
test_ica.py,
test_ica_precompile.py,
test_upgrade.py,
test_mempool.py,
test_pruned_node.py,
test_replay_block.py,
test_rollback.py
Added various pytest markers to categorize and select tests.
scripts/run-integration-tests Modified to conditionally run tests based on the TESTS_TO_RUN environment variable.

Poem

🐇 "In the realm of code, a change took flight,
🧪 Tests now dance to a matrix so bright.
🏷️ With markers in hand, they sort with grace,
⚙️ A rabbit's touch in the CI/CD space." 🚀

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on X ?


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can reply to a review comment made by CodeRabbit.
  • You can tag CodeRabbit on specific lines of code or files in the PR by tagging @coderabbitai in a comment.
  • You can tag @coderabbitai in a PR comment and ask one-off questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 12aa3ad and 7afb5f2.
Files selected for processing (12)
  • .github/workflows/test.yml (1 hunks)
  • Makefile (1 hunks)
  • integration_tests/conftest.py (1 hunks)
  • integration_tests/test_ibc.py (1 hunks)
  • integration_tests/test_ibc_rly.py (1 hunks)
  • integration_tests/test_ibc_rly_gas.py (1 hunks)
  • integration_tests/test_ibc_timeout.py (1 hunks)
  • integration_tests/test_ibc_update_client.py (1 hunks)
  • integration_tests/test_ica.py (1 hunks)
  • integration_tests/test_ica_precompile.py (1 hunks)
  • integration_tests/test_upgrade.py (1 hunks)
  • scripts/run-integration-tests (1 hunks)
Files skipped from review due to trivial changes (3)
  • integration_tests/test_ica.py
  • integration_tests/test_ica_precompile.py
  • integration_tests/test_upgrade.py
Additional comments: 9
.github/workflows/test.yml (1)
  • 20-24: The addition of a matrix strategy for parallel test execution is a good improvement. Ensure that the corresponding job steps are correctly configured to utilize the TESTS_TO_RUN environment variable set by the matrix.
Makefile (1)
  • 222-226: The TESTS_TO_RUN variable has been introduced correctly. It's important to ensure that the scripts and commands that depend on this variable are updated to handle the new possible values.
integration_tests/conftest.py (1)
  • 16-24: The addition of new markers and the logic to automatically add an "unmarked" marker to tests without any markers are correctly implemented. This will help categorize the tests for the parallel execution strategy.
integration_tests/test_ibc.py (1)
  • 15-15: The pytestmark decorator has been added with the gov marker. Verify that this marker is intended for the tests in this file, as it will affect test selection during execution.
integration_tests/test_ibc_rly.py (1)
  • 31-31: The pytestmark decorator has been added with the gov marker. Verify that this marker is intended for the tests in this file, as it will affect test selection during execution.
integration_tests/test_ibc_rly_gas.py (1)
  • 7-7: The pytestmark decorator has been added with the gov marker. Verify that this marker is intended for the tests in this file, as it will affect test selection during execution.
integration_tests/test_ibc_timeout.py (1)
  • 12-12: The pytestmark decorator has been added with the gov marker. Verify that this marker is intended for the tests in this file, as it will affect test selection during execution.
integration_tests/test_ibc_update_client.py (1)
  • 9-9: The pytestmark decorator has been added with the gov marker. Verify that this marker is intended for the tests in this file, as it will affect test selection during execution.
scripts/run-integration-tests (1)
  • 15-23: The script has been updated to conditionally run tests based on the TESTS_TO_RUN environment variable. Ensure that the test execution commands are compatible with the expected values of this variable and that the conditional logic is robust.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7afb5f2 and 2d5562a.
Files selected for processing (1)
  • .github/workflows/test.yml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yml

Copy link

codecov bot commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (12aa3ad) 35.81% compared to head (46067ac) 16.02%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1271       +/-   ##
===========================================
- Coverage   35.81%   16.02%   -19.79%     
===========================================
  Files         116       80       -36     
  Lines       10653     6184     -4469     
===========================================
- Hits         3815      991     -2824     
+ Misses       6462     5114     -1348     
+ Partials      376       79      -297     

see 54 files with indirect coverage changes

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2d5562a and c6ef908.
Files selected for processing (10)
  • integration_tests/conftest.py (1 hunks)
  • integration_tests/test_basic.py (1 hunks)
  • integration_tests/test_broadcast.py (1 hunks)
  • integration_tests/test_gov_update_params.py (1 hunks)
  • integration_tests/test_ibc.py (1 hunks)
  • integration_tests/test_ibc_rly.py (1 hunks)
  • integration_tests/test_ibc_rly_gas.py (1 hunks)
  • integration_tests/test_ibc_timeout.py (1 hunks)
  • integration_tests/test_ibc_update_client.py (1 hunks)
  • scripts/run-integration-tests (2 hunks)
Files skipped from review due to trivial changes (2)
  • integration_tests/test_basic.py
  • integration_tests/test_ibc.py
Files skipped from review as they are similar to previous changes (4)
  • integration_tests/test_ibc_rly.py
  • integration_tests/test_ibc_timeout.py
  • integration_tests/test_ibc_update_client.py
  • scripts/run-integration-tests
Additional comments: 6
integration_tests/conftest.py (2)
  • 13-22: The addition of new markers for categorizing tests is in line with the PR's objectives to enable parallel execution of integration tests. Ensure that the existing test suite is compatible with these new markers and that no tests are unintentionally excluded from the test runs.

  • 25-28: The logic to add an "unmarked" marker to test items without any markers is a good practice for ensuring all tests are categorized. However, please verify that this new categorization does not interfere with the behavior of existing tests that may rely on not having any markers.

integration_tests/test_broadcast.py (1)
  • 8-8: The addition of the pytest.mark.gov marker is consistent with the PR's goal to categorize tests for parallel execution. Ensure that the tests marked with gov are correctly configured in the CI pipeline to run in the intended test group.
integration_tests/test_gov_update_params.py (2)
  • 2-2: The import of pytest is necessary for using the pytest framework's features, such as markers.

  • 6-6: The addition of the pytest.mark.gov marker is consistent with the PR's goal to categorize tests for parallel execution. Ensure that the tests marked with gov are correctly configured in the CI pipeline to run in the intended test group.

integration_tests/test_ibc_rly_gas.py (1)
  • 7-7: The addition of the pytest.mark.ibc_rly_gas marker is consistent with the PR's goal to categorize tests for parallel execution. Ensure that the tests marked with ibc_rly_gas are correctly configured in the CI pipeline to run in the intended test group.

@yihuang yihuang enabled auto-merge December 20, 2023 09:04
.github/workflows/test.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c6ef908 and 4b50db2.
Files selected for processing (9)
  • .github/workflows/test.yml (1 hunks)
  • integration_tests/conftest.py (1 hunks)
  • integration_tests/test_basic.py (3 hunks)
  • integration_tests/test_exported_genesis.py (1 hunks)
  • integration_tests/test_ibc_update_client.py (1 hunks)
  • integration_tests/test_mempool.py (1 hunks)
  • integration_tests/test_pruned_node.py (1 hunks)
  • integration_tests/test_replay_block.py (2 hunks)
  • integration_tests/test_rollback.py (1 hunks)
Files skipped from review due to trivial changes (4)
  • integration_tests/test_mempool.py
  • integration_tests/test_pruned_node.py
  • integration_tests/test_replay_block.py
  • integration_tests/test_rollback.py
Files skipped from review as they are similar to previous changes (2)
  • integration_tests/conftest.py
  • integration_tests/test_ibc_update_client.py
Additional comments: 6
.github/workflows/test.yml (1)
  • 20-24: The strategy for running integration tests in parallel using a matrix of test categories and setting the TESTS_TO_RUN environment variable accordingly looks good. Please ensure to verify the parallel execution of tests in the CI environment to confirm that it works as intended.
integration_tests/test_basic.py (4)
  • 141-142: The addition of the @pytest.mark.slow decorator to the test_statesync function is appropriate for categorizing the test for parallel execution. Please ensure that the categorization aligns with the intended parallel execution strategy.

  • 258-259: The addition of the @pytest.mark.slow decorator to the test_local_statesync function is appropriate for categorizing the test for parallel execution. Please ensure that the categorization aligns with the intended parallel execution strategy.

  • 862-863: The addition of the @pytest.mark.gov decorator to the test_submit_any_proposal function is appropriate for categorizing the test for parallel execution. Please ensure that the categorization aligns with the intended parallel execution strategy.

  • 867-868: The addition of the @pytest.mark.gov decorator to the test_submit_send_enabled function is appropriate for categorizing the test for parallel execution. Please ensure that the categorization aligns with the intended parallel execution strategy.

integration_tests/test_exported_genesis.py (1)
  • 9-9: The addition of the pytest.mark.slow decorator at the module level is appropriate for categorizing all tests in this file for parallel execution. Please ensure that the categorization aligns with the intended parallel execution strategy.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4b50db2 and 46067ac.
Files selected for processing (3)
  • .github/workflows/test.yml (1 hunks)
  • integration_tests/test_basic.py (1 hunks)
  • integration_tests/test_gov_update_params.py (1 hunks)
Files skipped from review due to trivial changes (2)
  • integration_tests/test_basic.py
  • integration_tests/test_gov_update_params.py
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test.yml

@yihuang yihuang added this pull request to the merge queue Dec 20, 2023
Merged via the queue into crypto-org-chain:main with commit b47e5c1 Dec 20, 2023
29 of 30 checks passed
@yihuang yihuang deleted the parallel-test branch December 20, 2023 14:35
mmsqe pushed a commit to mmsqe/cronos that referenced this pull request Dec 22, 2023
)

* Problem: integration tests CI spend a lot of time

Solution:
- run in parallel using markers and job matrix

* fix matrix

* flock is not nesserary

* fix marker

* break up ibc test cases

* separate gov test cases

* split out some slow test cases

* split more ibc test

* Update .github/workflows/test.yml

Signed-off-by: yihuang <[email protected]>

* fix pytest lint

* more balance

---------

Signed-off-by: yihuang <[email protected]>
mmsqe added a commit that referenced this pull request Dec 22, 2023
…1277)

* Problem: integration tests CI spend a lot of time (#1271)

* Problem: integration tests CI spend a lot of time

Solution:
- run in parallel using markers and job matrix

* fix matrix

* flock is not nesserary

* fix marker

* break up ibc test cases

* separate gov test cases

* split out some slow test cases

* split more ibc test

* Update .github/workflows/test.yml

Signed-off-by: yihuang <[email protected]>

* fix pytest lint

* more balance

---------

Signed-off-by: yihuang <[email protected]>

* Update integration_tests/conftest.py

Co-authored-by: yihuang <[email protected]>
Signed-off-by: mmsqe <[email protected]>

---------

Signed-off-by: yihuang <[email protected]>
Signed-off-by: mmsqe <[email protected]>
Co-authored-by: yihuang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants