UT error in test_glance
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
os-xenapi |
Fix Released
|
Medium
|
Jianghua Wang |
Bug Description
I met randomly UT failure within test_glance:
Successful log: http://
Failed log:
http://
2018-03-21 10:39:37.989937 | ubuntu-xenial | =======
2018-03-21 10:39:37.990087 | ubuntu-xenial | FAIL: os_xenapi.
2018-03-21 10:39:37.990132 | ubuntu-xenial | tags: worker-3
2018-03-21 10:39:37.990239 | ubuntu-xenial | -------
2018-03-21 10:39:37.990301 | ubuntu-xenial | Traceback (most recent call last):
2018-03-21 10:39:37.990520 | ubuntu-xenial | File "/home/
2018-03-21 10:39:37.990592 | ubuntu-xenial | return func(*args, **keywargs)
2018-03-21 10:39:37.990755 | ubuntu-xenial | File "os_xenapi/
2018-03-21 10:39:37.990837 | ubuntu-xenial | mock_extract_
2018-03-21 10:39:37.991063 | ubuntu-xenial | File "/home/
2018-03-21 10:39:37.991124 | ubuntu-xenial | raise AssertionError(msg)
2018-03-21 10:39:37.991248 | ubuntu-xenial | AssertionError: Expected 'extract_tarball' to have been called once. Called 0 times.
2018-03-21 10:39:37.991297 | ubuntu-xenial | Ran 269 tests in 1.263s
2018-03-21 10:39:37.991347 | ubuntu-xenial | FAILED (id=0, failures=1)
It's easy to reproduce this problem with master branch also.
With some debug. I think it's due to the mock on urlopen doesn't take effective sometime (not sure why it does work sometime).
Successful##### tests.plugins. test_glance. GlanceTestCase. test_download_ ok_extract_ failed tests.plugins. test_glance. GlanceTestCase. test_download_ ok_extract_ failed [ multipart charset= utf8 tarball 'fake_stderr' 0^M
time: 2018-03-22 03:10:23.251676Z
tags: worker-3
test: os_xenapi.
time: 2018-03-22 03:10:23.260027Z
successful: os_xenapi.
Content-Type: text/plain;
stdout
90^M
wjh: calling utils.extract_
wjh: finally
error is 'fake_cmd' returned non-zero exit code: retcode=0, out='fake_out', stderr=
]
## failed#### tests.plugins. test_glance. GlanceTestCase. test_download_ ok_extract_ failed tests.plugins. test_glance. GlanceTestCase. test_download_ ok_extract_ failed [ multipart charset= utf8 traceback; language= python, charset= utf8 os-xenapi/ .tox/py27/ lib/python2. 7/site- packages/ mock/mock. py", line 1305, in patched tests/plugins/ test_glance. py", line 126, in test_download_ ok_extract_ failed extract_ tarball. assert_ called_ once() os-xenapi/ .tox/py27/ lib/python2. 7/site- packages/ mock/mock. py", line 915, in assert_called_once
test: os_xenapi.
time: 2018-03-22 03:07:50.162910Z
failure: os_xenapi.
Content-Type: text/plain;
stdout
1D^M
error is <urlopen error None>0^M
Content-Type: text/x-
traceback
215^M
Traceback (most recent call last):
File "/root/
return func(*args, **keywargs)
File "os_xenapi/
mock_
File "/root/
raise AssertionError(msg)
AssertionError: Expected 'extract_tarball' to have been called once. Called 0 times.
0^M
]