Bug 1516780

Summary: modify exit to graceful error on test 004_basic_sanity.verify_add_vm_template
Product: [Community] ovirt-system-tests Reporter: Dafna Ron <dron>
Component: GeneralAssignee: Yaniv Kaul <ykaul>
Status: CLOSED CURRENTRELEASE QA Contact: Lukas Svaty <lsvaty>
Severity: low Docs Contact:
Priority: unspecified    
Version: 2.0CC: bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-24 12:35:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: External RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dafna Ron 2017-11-23 11:24:27 UTC
failure in OST exits with following error:
scenarios/004_basic_sanity.py", line 500, in <lambda>\n    lambda: api.vms.get(VM1_NAME).status.state == \'down\',\nAttributeError: \'NoneType\' object has no attribute \'status\'\n--------------------- >> end captured logging << ---------------------'


This is a little confusing as to the reason of failure and it would be helpful in future debug if the tests exists with graceful error. 


Further info from ykaul on ovirt list: 


    This is a test error - code like this is always wrong:

        api.vms.get(VM1_NAME).status.state == something

    In this case, api.vms.get() returned None. The test code
    should handle None and fail with meaningfull error, or maybe
    retry the call.


It doesn't matter - if api.vms.get(VM1_NAME) return None, we'll fail the test. So we can add an assert here, but still fail in exactly the same manner. 
Gracefully with 'VM1_NAME was not found' ? Perhaps.

Comment 1 Yaniv Kaul 2017-11-23 11:25:54 UTC
Not sure why it's assigned to me, but I can take a look at this.

Comment 2 Yaniv Kaul 2017-11-23 12:41:30 UTC
Hopefully looks better with https://gerrit.ovirt.org/84572 .
I assume there are many other places in the code we'll need to 'harden' for such issues.