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

test(robot): add test strict local volume disabled revision conuter by default #2080

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

yangchiu
Copy link
Member

@yangchiu yangchiu commented Sep 3, 2024

Which issue(s) this PR fixes:

Issue longhorn/longhorn#9318

What this PR does / why we need it:

add test strict local volume disabled revision conuter by default

Special notes for your reviewer:

Additional documentation or context

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced new keywords for validating and managing volume, engine, and replica settings.
    • Added functionality for disaster recovery volume creation and validation.
    • New test case added to verify volume revision counter behavior.
  • Bug Fixes

    • Improved cleanup process with additional reset settings functionality.
  • Documentation

    • Expanded resources for end-to-end testing related to node and volume management.

@yangchiu yangchiu self-assigned this Sep 3, 2024
@yangchiu yangchiu requested a review from a team as a code owner September 3, 2024 08:46
Copy link
Collaborator

@khushboo-rancher khushboo-rancher left a comment

Choose a reason for hiding this comment

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

LGTM, few minor comments.

Also, do we want to add the test skeleton also for longhorn/longhorn#9279 (comment)?

@@ -9,7 +9,7 @@ class CRD(Base):
def __init__(self):
self.obj_api = client.CustomObjectsApi()

def get_engines(self, volume_name, node_name):
def get_engines(self, volume_name, node_name=None):
if volume_name == "" or node_name == "":
Copy link
Collaborator

Choose a reason for hiding this comment

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

If condition should be based on node_name None

@@ -283,9 +283,7 @@ def create_persistentvolumeclaim_for_volume(self, volume_name, retry=True):

def record_volume_replica_names(self, volume_name):
replica_list = self.replica.get(volume_name, node_name="")
assert replica_list != "", f"failed to get replicas"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's the reason of removing it?

@@ -283,9 +283,7 @@ def create_persistentvolumeclaim_for_volume(self, volume_name, retry=True):

def record_volume_replica_names(self, volume_name):
replica_list = self.replica.get(volume_name, node_name="")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to replace node_name="" to node_name=None?

@@ -296,12 +294,13 @@ def check_volume_replica_names_recorded(self, volume_name):
expected_replica_names = sorted(replica_names_str.split(","))

replica_list = self.replica.get(volume_name, node_name="")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above node_name

@yangchiu yangchiu force-pushed the revision branch 2 times, most recently from 40aa942 to c2871b2 Compare September 19, 2024 11:08
@longhorn longhorn deleted a comment from mergify bot Sep 19, 2024
@yangchiu yangchiu force-pushed the revision branch 2 times, most recently from 4a96ece to fea63ff Compare September 19, 2024 11:20
@yangchiu yangchiu requested review from khushboo-rancher and a team September 19, 2024 11:21
@@ -495,3 +497,7 @@ def upgrade_engine_image(self, volume_name, engine_image_name):

def wait_for_engine_image_upgrade_completed(self, volume_name, engine_image_name):
return Rest(self.node_exec).wait_for_engine_image_upgrade_completed(volume_name, engine_image_name)
def validate_volume_setting(self, volume_name, setting_name, value):
Copy link
Contributor

Choose a reason for hiding this comment

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

Add an extra line of separation in the function.

@@ -33,10 +33,7 @@ def delete(self, volume_name, node_name):
logging(
f"Deleting volume {volume_name} on node {node_name} replicas")

resp = self.get(volume_name, node_name)
assert resp != "", f"failed to get replicas"
Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding the removal of assert resp != "", f"failed to get replicas", could you explain the main reasoning behind removing this step? I don't quite understand it.

Copy link
Collaborator

@khushboo-rancher khushboo-rancher left a comment

Choose a reason for hiding this comment

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

LGTM from my side.

@roger-ryao has few questions.

…y default

Signed-off-by: Yang Chiu <yang.chiu@suse.com>
@khushboo-rancher
Copy link
Collaborator

@roger-ryao Could you take a look whenever get a chance?

Copy link
Contributor

@roger-ryao roger-ryao left a comment

Choose a reason for hiding this comment

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

LGTM, but I noticed that @khushboo-rancher and I have similar questions. If possible, could you also explain the reason for removing these two sections, so we can understand more?

#2080 (comment)
#2080 (comment)

Copy link

coderabbitai bot commented Oct 21, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces multiple enhancements across various resource files and libraries related to end-to-end (e2e) testing for volume management, engine settings, and replica configurations. Key changes include the addition of new keywords for validating and managing settings, the introduction of a cleanup functionality, and modifications to existing methods to accommodate new parameters. Additionally, new test cases have been added to ensure comprehensive testing of the updated functionalities.

Changes

File Change Summary
e2e/keywords/common.resource Updated Cleanup test resources to include reset_settings after reset_backupstore.
e2e/keywords/engine.resource Added keyword Volume ${volume_id} engine ${setting_name} should be ${setting_value}; modified existing keyword for clarity.
e2e/keywords/replica.resource Introduced new resource file with keyword Volume ${volume_id} replica ${setting_name} should be ${setting_value}.
e2e/keywords/volume.resource Added keywords for disaster recovery and volume restoration; modified existing keyword for engine upgrade.
e2e/libs/engine/crd.py Updated get_engines method to make node_name optional; added validate_engine_setting method.
e2e/libs/engine/engine.py Added validate_engine_setting method to validate engine settings.
e2e/libs/keywords/engine_keywords.py Added validate_engine_setting method to call the corresponding method in Engine.
e2e/libs/keywords/replica_keywords.py Introduced replica_keywords.py with validate_replica_setting method.
e2e/libs/keywords/setting_keywords.py Added reset_settings method to reset settings.
e2e/libs/keywords/volume_keywords.py Updated create_volume method to include dataLocality; added validate_volume_setting.
e2e/libs/replica/crd.py Updated get method to make node_name optional; added validate_replica_setting.
e2e/libs/replica/replica.py Added validate_replica_setting method.
e2e/libs/setting/setting.py Introduced reset_settings method to reset settings to default values.
e2e/libs/volume/crd.py Updated create method to include dataLocality; added validate_volume_setting.
e2e/libs/volume/rest.py Updated create method to include dataLocality.
e2e/libs/volume/volume.py Updated create method to include dataLocality; added validate_volume_setting.
e2e/tests/regression/test_basic.robot Added new resources and test case for volume revision counter behavior.

Assessment against linked issues

Objective Addressed Explanation
Add/update auto e2e test cases for issue #9279

Suggested reviewers

  • khushboo-rancher

Poem

In the land of code where rabbits play,
New keywords hop in without delay.
With settings reset and volumes aligned,
Our tests will flourish, all bugs left behind.
So let’s celebrate with a joyful cheer,
For cleaner code brings us all near! 🐇✨


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 your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@yangchiu yangchiu merged commit 86eb70b into longhorn:master Oct 21, 2024
5 of 7 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.

3 participants