Unit tests shouldn't take config
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Confirmed
|
Low
|
Unassigned |
Bug Description
From a fresh checkout on a pretty bare VM, running unit tests leads with
Unable to read test config /etc/swift/
Why do we expect swift to already be configured?? Let's dig around a bit...
OK, looks like that message came out of get_config [1], and *not* having that file will just get us a default config and still run everything... but that's not at all obvious from the message -- as soon as I see some out-of-band message coming out of my tests, I start to question the result, even if it "passes". And we still haven't explained *why unit tests need config at all*.
Looking for get_config under test/unit/, the only reference [2] gets fake_syslog to decide whether or not to replace logging.
So maybe we should *always* replace SysLogHandler, and make our unit tests more encapsulated. Oops, now tests don't pass:
=======
FAIL: test_get_
-------
Traceback (most recent call last):
File "/vagrant/
syslog_
AssertionError: Lists differ: [((), {'facility': 19, 'addres... != [((), {'facility': 19, 'addres...
First list contains 1 additional elements.
First extra element 1:
((), {'facility': 19})
- [((), {'address': '/foo/bar', 'facility': 19}), ((), {'facility': 19})]
+ [((), {'address': '/foo/bar', 'facility': 19})]
But running common/
./.unittests common/
common/
...all of which seems to reinforce the idea that unit tests *shouldn't take config* -- we've clearly not been testing with the other config!
[1] https:/
[2] https:/
[3] https:/
[4] https:/
[5] https:/
Changed in swift: | |
status: | New → Confirmed |
importance: | Undecided → Low |
tags: | added: low-hanging-fruit |
Related fix proposed to branch: master /review. openstack. org/506410
Review: https:/