Skip to content
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

Merged
merged 2 commits into from
Nov 23, 2016

Conversation

ashahi1
Copy link
Contributor

@ashahi1 ashahi1 commented Nov 23, 2016

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'
..

@msterin msterin merged commit 9c3d15c into vmware-archive:master Nov 23, 2016
@ashahi1 ashahi1 deleted the issueImproveLogging762.ashahi1 branch December 15, 2016 08:54
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants