BIND 10 #2823: complete removing threads from stats tests
BIND 10 Development
do-not-reply at isc.org
Mon May 6 10:55:08 UTC 2013
#2823: complete removing threads from stats tests
-------------------------------------+-------------------------------------
Reporter: jinmei | Owner:
Type: defect | jinmei
Priority: medium | Status:
Component: statistics | reviewing
Keywords: | Milestone:
Sensitive: 0 | Sprint-20130514
Sub-Project: DNS | Resolution:
Estimated Difficulty: 5 | CVSS Scoring:
Total Hours: 0 | Defect Severity: N/A
| Feature Depending on Ticket:
| Add Hours to Ticket: 0
| Internal?: 0
-------------------------------------+-------------------------------------
Changes (by vorner):
* owner: vorner => jinmei
Comment:
Hello
The tests fail for me:
{{{
FAIL: test_do_GET (__main__.TestHttpHandler)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/var/tmp/bind10/bind10-2/bind10-20130221/_build/../src/bin/stats/tests
/stats-httpd_test.py", line 309, in test_do_GET
check_XML_URL_PATH()
File
"/var/tmp/bind10/bind10-2/bind10-20130221/_build/../src/bin/stats/tests
/stats-httpd_test.py", line 304, in check_XML_URL_PATH
self.assertEqual(attr['value'], str(value))
AssertionError: '1308759248.0' != '1308726848.0'
- 1308759248.0
? --
+ 1308726848.0
? ++
}}}
This testcase is somewhat useless, with the return at the start of it:
{{{#!python
class TestOSEnv(unittest.TestCase):
def test_osenv(self):
"""
test for the environ variable "B10_FROM_SOURCE"
"B10_FROM_SOURCE" is set in Makefile
"""
return
# test case having B10_FROM_SOURCE
self.assertTrue("B10_FROM_SOURCE" in os.environ)
self.assertEqual(stats.SPECFILE_LOCATION, \
os.environ["B10_FROM_SOURCE"] + os.sep + \
"src" + os.sep + "bin" + os.sep + "stats" + \
os.sep + "stats.spec")
# test case not having B10_FROM_SOURCE
path = os.environ["B10_FROM_SOURCE"]
os.environ.pop("B10_FROM_SOURCE")
self.assertFalse("B10_FROM_SOURCE" in os.environ)
# import stats again
imp.reload(stats)
# revert the changes
os.environ["B10_FROM_SOURCE"] = path
imp.reload(stats)
}}}
Do statistics really do such a strange thing as here? Once the queries per
zone are a list with names inside the items, once it is named set:
{{{#!python
'Auth': {'queries.udp': 4, 'queries.tcp': 6,
'queries.perzone': [
{'queries.udp': 8, 'queries.tcp': 10,
'zonename': 'test1.example'},
{'queries.udp': 6, 'queries.tcp': 8,
'zonename': 'test2.example'}],
'nds_queries.perzone': {
'test10.example': {'queries.udp': 8, 'queries.tcp':
10},
'test20.example': {'queries.udp': 6, 'queries.tcp':
8}}}}
}}}
What is the purpose of this test? Does it really test that the test code
throws an exception?
{{{#!python
def test_init_hterr(self):
class FailingStatsHttpd(SimpleStatsHttpd):
def open_httpd(self):
raise stats_httpd.HttpServerError
self.assertRaises(stats_httpd.HttpServerError, FailingStatsHttpd)
}}}
Also, there's lot of code snippets like:
{{{#!python
self.assertEqual(None, something)
}}}
Would it be better to use
{{{#!python
self.assertIsNone(something)
}}}
The same with `assertIsNotNone`.
--
Ticket URL: <http://bind10.isc.org/ticket/2823#comment:9>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list