Running tests via nosestests fails due to insufficient test isolation
Bug #1658200 reported by
Lars Kellogg-Stedman
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned |
Bug Description
I don't know if we care about this or not, since it involves a test harness other than tox.
Attempting to run the unittests using nosetests (nosetets tests/unittests) will fail because the _set_mock_metadata method appears to only run once...so tests that expect non-default metadata (such as test_instance_
This can be avoided by calling httppretty.reset() before calling httppretty.
Related branches
~larsks/cloud-init:lp/1658200
- cloud-init Commiters: Pending requested
-
Diff: 10 lines (+1/-0)1 file modifiedtests/unittests/test_datasource/test_gce.py (+1/-0)
Changed in cloud-init: | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
To post a comment you must log in.
A failure looks like this:
..... ....... ....... ...SSSSS. ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ....... ......F ======= ======= ======= ======= ======= ======= ======= ======= ======= == level_keys_ replace_ project_ level_keys (tests. unittests. test_datasource .test_gce. TestDataSourceG CE) ------- ------- ------- ------- ------- ------- ------- ------- ------- -- lars/src/ cloud-init/ tests/unittests /test_datasourc e/test_ gce.py" , line 150, in test_instance_ level_keys_ replace_ project_ level_keys assertEqual( [key_content] , self.ds. get_public_ ssh_keys( ))
=====
FAIL: test_instance_
-----
Traceback (most recent call last):
File "/home/
self.
AssertionError: Lists differ: ['ssh-rsa JustAUser root@server'] != ['ssh-rsa AA2..+aRD0fyVw== root@server']
First differing element 0:
ssh-rsa JustAUser root@server
ssh-rsa AA2..+aRD0fyVw== root@server
- ['ssh-rsa JustAUser root@server'] ------- ------- - >> begin captured logging << ------- ------- ------ url_helper: DEBUG: [0/1] open 'http:// metadata. google. internal/ computeMetadata /v1/instance/ id' with {'url': 'http:// metadata. google. internal/ computeMetadata /v1/instance/ id', 'allow_redirects': True, 'method': 'GET', 'headers': {'X-Google- Metadata- Request' : 'True', 'User-Agent': 'Cloud- Init/0. 7.9'}} configuration packages. urllib3. connectionpool: INFO: Starting new HTTP connection (1): metadata. google. internal packages. urllib3. connectionpool: DEBUG: "GET /computeMetadat a/v1/instance/ id HTTP/1.1" 200 3 url_helper: DEBUG: Read from http:// metadata. google. internal/ computeMetadata /v1/instance/ id (200, 3b) after 1 attempts url_helper: DEBUG: [0/1] open 'http:// metadata. google. internal/ computeMetadata /v1/instance/ zone' with {'url': 'http:// metadata. google. internal/ computeMetadata /v1/instance/ zone', 'allow_redirects': True, 'method': 'GET', 'headers': {'X-Google- Metadata- Request' : 'True', 'User-Agent': 'Cloud- Init/0. 7.9'}} configuration packages. urllib3. connectionpool: INFO: Starting new HTTP connection (1): metadata. google. internal packages. urllib3. connectionpool: DEBUG: "GET /computeMetadat a/v1/instance/ zone HTTP/1.1" 200 7 url_helper: DEBUG: Read from http:// metadata. google. internal/ computeMetadata /v1/instance/ zone (200, 7b) after 1 attempts url_helper: DEBUG: [0/1] open 'http:// metadata. google. internal/ computeMetadata /v1/instance/ hostname' with {'url': 'http:// metadata. google. internal/ computeMetadata /v1/instance/ hostname', 'allow_redirects': True, 'method': 'GET', 'headers': {'X-Google- Metadata- Request' : 'True', 'User-Agent': 'Cloud- Init/0. 7.9'}} configuration packages. urllib3. connectionpool: INFO: Starting new HTTP connection (1): metadata. google. internal packages. urllib3. connectionpool: DEBUG: "GET /computeMetadat a/v1/instance/ hostname HTTP/1.1" 200 24 url_helper: DEBUG: Read from http:// metadata. google. internal/ computeMetadata /v1/instance/ hostname (200, 24b) after 1 attempts url_helper: DEBUG:...
+ ['ssh-rsa AA2..+aRD0fyVw== root@server']
-----
cloudinit.
requests.
requests.
cloudinit.
cloudinit.
requests.
requests.
cloudinit.
cloudinit.
requests.
requests.
cloudinit.
cloudinit.