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: update max-tx-gas-wanted is redundant in subscribe test #1238

Merged
merged 5 commits into from
Nov 14, 2023

Conversation

mmsqe
Copy link
Collaborator

@mmsqe mmsqe commented Nov 13, 2023

default max-tx-gas-wanted is 0

👮🏻👮🏻👮🏻 !!!! 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

  • Refactor

    • Simplified test setup by removing unnecessary modify_command_in_supervisor_config function and its usage.
    • Improved test readability and potential flakiness by reordering function calls and replacing asyncio.gather with individual await calls.
  • Tests

    • Removed a redundant test case related to the now-removed modify_command_in_supervisor_config function.
    • Updated test_tx_inclusion to handle a new max_gas_wanted parameter, enhancing test flexibility.

@mmsqe mmsqe requested a review from a team as a code owner November 13, 2023 03:17
@mmsqe mmsqe requested review from yihuang and leejw51crypto and removed request for a team November 13, 2023 03:17
Copy link
Contributor

coderabbitai bot commented Nov 13, 2023

Walkthrough

The changes across the integration_tests module involve the removal of a function related to supervisor configuration modification and its associated test cases. Additionally, there's a shift from concurrent to sequential execution of certain test functions. In a separate test file, a new parameter is introduced to control test execution flow, enhancing the test's flexibility.

Changes

File Path Change Summary
.../test_subscribe.py Removed modify_command_in_supervisor_config function and usage, replaced asyncio.gather with await for transfer_test and logs_test, removed related test case.
.../test_basic.py Added max_gas_wanted parameter to test_tx_inclusion, updated modify_command_in_supervisor_config usage.

Poem

As autumn leaves fall, we refactor with glee, 🍂
Code pruned like branches, now simpler to see.
Tests flow in sequence, like a calm, steady stream,
And with each new commit, our codebase does gleam. ✨


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

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 376da21 and 6e717b7.
Files selected for processing (1)
  • integration_tests/test_subscribe.py (2 hunks)
Files skipped from review due to trivial changes (1)
  • integration_tests/test_subscribe.py

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 6e717b7 and 6fc68e7.
Files selected for processing (1)
  • integration_tests/test_subscribe.py (3 hunks)
Additional comments: 3
integration_tests/test_subscribe.py (3)
  • 16-21: ```
    The removal of the modify_command_in_supervisor_config function is not shown in this hunk, but it is mentioned in the summary. Ensure that its removal does not affect other tests or parts of the code that might be relying on it. If this function was used elsewhere, those usages need to be refactored or removed as well.

---end hunk 0---

---start hunk 1---


* 86-91: ```
The code here appears to be unchanged and is likely provided for context. Since there are no modifications in this hunk, there's nothing to review.

---end hunk 1---

---start hunk 2---
  • 155-165: ```
    The reordering of function calls within the async_test function seems to be done to ensure that the `transfer_test` and `logs_test` are called after the `subscriber_test`. This change could be for clarity or optimization. However, without additional context on the reason for the reordering, it's difficult to assess the impact. Ensure that the reordering does not affect the test outcomes or introduce race conditions.

---end hunk 2---

@yihuang yihuang enabled auto-merge November 13, 2023 07:29
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 6fc68e7 and 7539755.
Files selected for processing (1)
  • integration_tests/test_subscribe.py (3 hunks)
Additional comments: 3
integration_tests/test_subscribe.py (3)
  • 15-20: The removal of modify_command_in_supervisor_config function usage is noted. Ensure that this function is not used elsewhere in the codebase or by other tests that may rely on its functionality. If it is still used elsewhere, consider whether it should be deprecated entirely or if its removal here is a special case.

  • 84-89: The documentation for the test_subscribe_basic function is clear and concise. The setup for the test environment, including waiting for the port to be ready, is appropriate.

  • 153-163: The change from asyncio.gather to individual await calls for transfer_test and logs_test functions is a significant alteration in how these asynchronous tasks are being executed. This change could potentially alter the timing and order of operations, which may affect the test outcomes. Verify that the tests still pass and that the change in concurrency does not introduce any new issues or race conditions.

Additionally, the cancellation of the receive_loop task and the handling of CancelledError is a good practice to ensure that resources are cleaned up properly when the test is finished or if it times out.

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: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 7539755 and fdb7d97.
Files selected for processing (1)
  • integration_tests/test_basic.py (3 hunks)
Additional comments: 5
integration_tests/test_basic.py (5)
  • 785-791: The introduction of the max_gas_wanted parameter and the early return when it is None is a good approach to handle default behavior. However, ensure that the default behavior (when max_gas_wanted is None) is indeed to perform no action, as this changes the previous behavior of the function.

  • 805-805: The modify_command_in_supervisor_config function is being removed as per the PR summary. Ensure that all references to this function are removed and that the removal does not affect other parts of the test suite that might rely on the modified command behavior.

  • 809-810: The call to cronos.supervisorctl("update") and wait_for_port seems to be related to the configuration change made by the now-removed modify_command_in_supervisor_config. If this function is removed, verify that these calls are still necessary and that they function correctly without the configuration modification.

  • 813-814: The early return when max_gas_wanted is None is clear and concise. This is a good use of a guard clause to simplify the flow of the function.

  • 816-818: The block_gas_limit is hardcoded here. Ensure that this value is consistent with the actual block gas limit configured in the blockchain node. If the block gas limit is subject to change, consider fetching it dynamically from the node's configuration or state.

integration_tests/test_basic.py Show resolved Hide resolved
@yihuang yihuang added this pull request to the merge queue Nov 14, 2023
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #1238 (fdb7d97) into main (54e4d9c) will decrease coverage by 20.23%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1238       +/-   ##
===========================================
- Coverage   36.89%   16.67%   -20.23%     
===========================================
  Files         115       79       -36     
  Lines       10255     5786     -4469     
===========================================
- Hits         3784      965     -2819     
+ Misses       6097     4743     -1354     
+ Partials      374       78      -296     

see 54 files with indirect coverage changes

Merged via the queue into crypto-org-chain:main with commit 607fa83 Nov 14, 2023
20 of 21 checks passed
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