Skip to content

[virsh metadata] change the checking logic for missing metadata #6376

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhentang-tz
Copy link
Contributor

from libvirt 11.3.0, instead of return status error, libvirt will return an empty string if there is no metadata to be returned Added a new parameter 'metadata_empty' for the negative test cases. This parameter is used to verify that the metadata were not altered by the preceding command.

refer to
https://gitlab.com/libvirt/libvirt/-/commit/312088d9b62334c950310f369b2e0fe2302a74a3 --- tools: virsh: metadata: do not report error on missing metadata

from libvirt 11.3.0, instead of return status error, libvirt will return an empty string if there is no metadata to be returned
Added a new parameter 'metadata_empty' for the negative test cases. This parameter is used to verify that the metadata were not altered by the preceding command.

refer to
https://gitlab.com/libvirt/libvirt/-/commit/312088d9b62334c950310f369b2e0fe2302a74a3
--- tools: virsh: metadata: do not report error on missing metadata

Signed-off-by: zhentang-tz <[email protected]>
@zhentang-tz
Copy link
Contributor Author

hi @smitterl , could you help review this pr? Thanks.

@@ -110,6 +111,10 @@ def get_metadata(metadata_option=""):
**virsh_dargs)
check_result(result, status_error)
# Get metadata
# from libvirt 11.3.0, instead of return status error, libvirt will return an empty string if there is no metadata to be returned
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this comment in favor of cleaner code, the information is available in your commit message.

@@ -137,6 +142,6 @@ def get_metadata(metadata_option=""):
check_result(result, status_error)
# Get metadata again
for option in metadata_option.split():
check_result(get_metadata(metadata_option=option), True)
check_result(get_metadata(metadata_option=option), False, '')
Copy link
Contributor

Choose a reason for hiding this comment

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

Will negative scenarios now fail for previous libvirt versions? If so, maybe the negative scenarios should only be run with 11.3.0 or later. This can be achieved by using version switch as described here: https://github.com/autotest/tp-libvirt/blob/master/tp-libvirt_review_comment_summary.rst?plain=1#L121

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