Robottelo: tests/robottelo/test_vm is not isolated from test_host_info

Created on 10 Feb 2020  路  2Comments  路  Source: SatelliteQE/robottelo

IDEA: I think this approach is wrong, and each test should be isolated. Isolation problem can also occur on another places I just don't try it.

problem is when you run
py.test tests/robottelo/test_vm.py
result will be:
6 failed, 3 passed - where all fails are connected to error below. (3 passed only because these 3 test are negative)
robottelo.vm.VirtualMachineError: Cannot find a default compatible distro to create the virtual machine

As in test_vm you can find vm = VirtualMachine() which requires distribution.

But when you run all tests py.test tests/robottelo all the tests are going to pass.
305 passed

@rplevka find out, that this is caused by test_host_info
precisely by get_host_os_version()
As this information is cached when test_cache is running, and then used again when test_vm goes on.

In code snap below you can see what happens when test_cache (all other tests from test_host_info are commented) ran before test_vm

py.test tests/robottelo/test_host_info.py tests/robottelo/test_vm.py

= test session starts =
collected 10 items                                                                                                                                                                                                                                                     

tests/robottelo/test_host_info.py .                                                                                                                                                                                                                             
tests/robottelo/test_vm.py .........   

=10 passed=
Bug

All 2 comments

I'm looking at addressing this behavior as part of #7686. Its easy enough to clear the lru_cache for get_host_info. Each test (or the fixture called by requisite tests) should be handling the mocking necessary for the test to function correctly.

I kept a separate commit in #7686 for addressing this behavior within the tests. That commit includes a FIXES statement, and will close this issue when merged to master.

Was this page helpful?
0 / 5 - 0 ratings