This repository has been archived by the owner on Nov 9, 2020. It is now read-only.
Vsan_policy_test: Additional log statement to the negative unit test #766
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.
Github Issue: #737
Test name: test_delete_nonexistent_policy_fails
Test is expected to fail since it tries to delete a non-existing vsan policy but from the console log its not clear if its an expected failure or its a genuine product issue.
So after this change we will see the following message on the console:
Delete_nonexistent_policy:This is a negative test to delete a non-existent vsan policy.
Test is expected to raise exception log - Failed to remove the policy file error.
Have created a new method in esx_service/utils/log_config.py to get the logger and using that logger, printing the output to the console.
Current console output:
Running unit tests in /tmp/vmdk_ops_unittest21044/vsan_policy_test.py...
...ERROR:root:Failed to remove test_policy policy file
Traceback (most recent call last):
File "/tmp/vmdk_ops_unittest21044/vsan_policy.py", line 209, in delete
os.remove(policy_path(name))
OSError: [Errno 2] No such file or directory: '/vmfs/volumes/vsan:52fe282b8b5a398c-e41bd80f9e940d46/dockvols/policies/test_policy'
..
Changed output:
Running unit tests in /tmp/vmdk_ops_unittest20224/vsan_policy_test.py...
...INFO:Delete_nonexistent_policy:
This is a negative test to delete a non-existent vsan policy.
Test is expected to raise exception log - Failed to remove the policy file error.
ERROR:root:Failed to remove test_policy policy file
Traceback (most recent call last):
File "/tmp/vmdk_ops_unittest20224/vsan_policy.py", line 210, in delete
os.remove(policy_path(name))
OSError: [Errno 2] No such file or directory: '/vmfs/volumes/vsan:527684c7080e3aa6-9bf81f1af23d5f1e/dockvols/policies/test_policy'
..