-
Notifications
You must be signed in to change notification settings - Fork 168
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
security/virt_what: add test for expected value #5854
Merged
+37
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- virt_what.cvm: | ||
type = virt_what_cvm | ||
start_vm = yes | ||
variants: | ||
- expected_value: | ||
# The EXPECTED_VALUE depends on the VM. A normal VM would have "". | ||
# man virt-what-cvm lists the available values for VM where | ||
# confidentiality is enabled | ||
expected_cvm = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import logging as log | ||
|
||
from virttest import utils_misc, utils_package | ||
|
||
|
||
logging = log.getLogger("avocado." + __name__) | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
Confirms that the output of virt-what-cvm is as expected. | ||
|
||
:params test: The avocado test object | ||
:params params: Parameters for the test | ||
:params env: The avocado test environment object | ||
""" | ||
vm_name = params.get("main_vm") | ||
vm = env.get_vm(vm_name) | ||
expected_cvm = params.get("expected_cvm") | ||
session = vm.wait_for_login() | ||
utils_package.package_install("virt-what", session=session) | ||
_, o = utils_misc.cmd_status_output("virt-what-cvm", session=session) | ||
if o.strip() != expected_cvm.strip(): | ||
test.fail( | ||
f"Unexpected value '{o.strip()}' instead of {expected_cvm.strip()}." | ||
" Note that the command is supported since virt-what-1.25-10." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,6 +170,7 @@ ctrl | |
currentvcpu | ||
curvcpu | ||
CVE | ||
cvm | ||
dac | ||
DAC | ||
darget | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it apply for s390x only now? I don't think currently x86 and arm have confident VM testing enabled in automation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The virt_what test category wasn't added to the test jobs of other architectures.
Even if it was added the test will pass in a non-confident test because then the output of the command will be an empty string. You can check our s390x job configuration: for normal guests, the test is not reconfigured, only for SE but it's run on both types of guest.