BIND 10 trac2179, updated. e5c5bdff63ef6efe4db1033b3de26c69fa21f92d [2179] added missing testdata files for statistics
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Aug 9 05:39:58 UTC 2012
The branch, trac2179 has been updated
discards 195647365f1b430fb6837454531067c7a872f9a1 (commit)
discards 55ab66227285eba50c4bca02d76f339834d56710 (commit)
discards e0832f0c78dd8a4cd36d2f17145a8f70b0089cd6 (commit)
discards 0b5f173681c9e167603a4f420679e70c38f8cfc1 (commit)
discards f1609762ee2641e245778e4465def59509ac081a (commit)
discards 2a0dd303927d9405b35b7e440f39335fb08b9093 (commit)
discards a768351ad6526b5c8563ab3145b0e24fdd542dc0 (commit)
discards 795f84a22aaf809c44c4739afd60eda3a0e9d0f8 (commit)
discards 347c79485e7e38fbcfa2ed77cb689063b5b016f8 (commit)
discards 3f922de50497aaac2c1454e8614db268fd45cdd1 (commit)
discards 58b6810a302a68dffdfc64ed991011d339246feb (commit)
discards 99b60989f294af3d7711176f31a487760318065d (commit)
discards 082d6a9435c0bf4eb31e334b0c527a277c6e7b30 (commit)
discards f8f9de23f77e701057ca03eed7388b6d1e050794 (commit)
discards 0472e39d599fb08acd60141a51a1839caaa2165d (commit)
discards c46ccb258d6d2ba5d42f5e672450bfbe69a9fd27 (commit)
discards 7e6d71c5e0a5be43e3d236ffda036d26708ed50a (commit)
discards 6d204445a85e55502898864e9cd865ff9463b466 (commit)
discards be0d496fc4885e3c340415eeb7e38e04ec2c74b5 (commit)
discards 2b1cbf918989de09682327530dc941448c5879d1 (commit)
discards 8f7ae09ae64882c5685d6bfc9605b4a7129abe75 (commit)
discards 4b300f5bdf874a8a1af25d081325471e3dc060f8 (commit)
discards 6c0bc0b402bbc16d4659a91a381c0b5c81594378 (commit)
discards 6d44728f8e1508dedf9ceaf1833e918c300c7530 (commit)
discards e206cb2d5d22d27aae219445133c449e58dfa3c0 (commit)
discards e7739c11cb126eb1ccde59ab7cbad61eff80fe1d (commit)
discards 4a50ef0287747928c8dbd4d045df9780df3c3840 (commit)
discards 4df681f83940c701a8b6e88e59cce9fe2a03981b (commit)
discards 5980e50577cca094153209d1565d641f63d9ebee (commit)
discards 1c195bb85881b91fae165ef5b8334da8b6611a00 (commit)
via e5c5bdff63ef6efe4db1033b3de26c69fa21f92d (commit)
via 321d9911f9f3ba6d08d852521106995e4ab223b1 (commit)
via 2c097fad9e397923862fee6c77fa953696c1434e (commit)
via 41085877d6a4124cc8dcf44521ca35c03ab289d7 (commit)
via 3e377dea92c7c685d7e9136e926bb7df4d7cb180 (commit)
via 07a1ba094496174c6d62458999c36bde17498c3c (commit)
via 4b19f8ee1250afec018f1b33981d62861b4499ff (commit)
via 37ce3a04782c3d2dd0b87c07662e7de8b6b69bf9 (commit)
via 2fc9bd636bac797227795e5697dedfd1632fdbc2 (commit)
via ec6716e2a75b4c18592a7b1157b37da2123de745 (commit)
via 003d0276c8140694e36ff7468fd1992e17afd6d0 (commit)
via e0a964e89cd91e560b6d2cff08f67296826fb2cf (commit)
via 1bbbf9d3e6083abef236fdb2eb782b299ef3121c (commit)
via 4eb908f8e222d1b3404e7d32d98a82201402789b (commit)
via 7e4d13a765da43d7241441db2236e1e6a73b5335 (commit)
via 3364acc50b843a875988b17c3cb4fac57508cb5c (commit)
via dde8b6049fe7c15cbc7e926177639cb87a706e8d (commit)
via cd4f19acfa69fefed0dd37d7d5275904f026e5a7 (commit)
via 785ab6a3e720a1e683afcca2da4a6691fc453e75 (commit)
via edb6cc58638ff43fb338b463660103e544ddcacd (commit)
via 30bbd3eb05036df144b1b9a364d22f1941222526 (commit)
via 6efc1e2e635a46a12a1cf8c601fdc1c7ae28b32b (commit)
via b9a77c84d6de3f0378709603ad57e1533f376871 (commit)
via 5fa38c20028899696a48c1a3b8edf54918cd252b (commit)
via 1045e7f9b31bd683fb3a100bbd24fd21d4ab2c7e (commit)
via c832cd2d0699320b1e6258a61aa34c797f796268 (commit)
via e60a5349460b72ca051e8fc2a07972200c837d83 (commit)
via 156fa6fbf1ebaf007de56dc2b1c9082b6f4ed041 (commit)
via 9d7105c0c05e2ab709b1ac3554461a30e48ded71 (commit)
via 715ea50c714014ee7f8aee95d7762434482d2f09 (commit)
via be7020b5461d37bbb95abfe84c78c797b80766e8 (commit)
via a519acdad6e7b15cf52d23c6ae0bfad3c843855a (commit)
via 0abcaf5cdd42eecfeb82aec54a68d74805a89e03 (commit)
via 86b531b99411ad1bc047e35cd3e0ddfd1cf501d7 (commit)
via 47dd0cc48213f82dbea6a6365be79fe85c260011 (commit)
via 4c67dd80aaab44f9cd153646f76c9c208b7abc35 (commit)
via da81d3d6b99ac696728924dac36a9adf7bb79169 (commit)
via c71cb1be7bea3537f6de97fef3ad25c4651a850f (commit)
via 9d21102f8822ad32f9879a2fe20a74f29ce72c2d (commit)
via 2e760ad9496385fe00fed546686b33417b7c9615 (commit)
via 9fd7da352dbaf73073aed881e82418c1eba93c4f (commit)
via 94d932029fddd38e608aa478eea96cdf59035487 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (195647365f1b430fb6837454531067c7a872f9a1)
\
N -- N -- N (e5c5bdff63ef6efe4db1033b3de26c69fa21f92d)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e5c5bdff63ef6efe4db1033b3de26c69fa21f92d
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Tue Aug 7 18:03:58 2012 +0900
[2179] added missing testdata files for statistics
commit 321d9911f9f3ba6d08d852521106995e4ab223b1
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Sun Aug 5 07:54:03 2012 +0900
[2179] added a proposed Changelog entry
commit 2c097fad9e397923862fee6c77fa953696c1434e
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Mon Aug 6 14:30:52 2012 +0900
[2179] Supported a identifier in isc.cc.data e.g. "xxx/yyy/zzz[i]"
If a target module returns data whose key name is such a identifier type, the
stats module can identify statistics data. The stats module checks the
validation of data even if such a identifier is specified. But when the stats
shows statistics data e.g. via bindctl, this type of identifier is not shown
for now.
commit 41085877d6a4124cc8dcf44521ca35c03ab289d7
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Mon Aug 6 14:26:43 2012 +0900
[2179] Supported a named_set data type
A named_set data type is supported in a spec file in each module for
statistics.
commit 3e377dea92c7c685d7e9136e926bb7df4d7cb180
Author: Naoki Kambe <kambe at jprs.co.jp>
Date: Sun Aug 5 07:53:29 2012 +0900
[2179] Supported differential statistics updates of Stats
Stats updates corresponding statistics data which each module returns. For
that, the method "update_statistics_data()" was updated to merge recursively
old value and new value each other. As for this merging, a new method
"merge_oldnew" was introduced into stats.py. This method is intended to be
internally used so far.
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 1 +
src/bin/stats/stats.py.in | 132 ++++++++++++++++++----------
src/bin/stats/tests/Makefile.am | 6 +-
src/bin/stats/tests/b10-config_test.db | 1 -
src/bin/stats/tests/b10-stats_test.py | 70 +++++++++++----
src/bin/stats/tests/test_utils.py | 2 +-
src/bin/stats/tests/testdata/Makefile.am | 1 +
src/bin/stats/tests/testdata/b10-config.db | 14 +++
8 files changed, 161 insertions(+), 66 deletions(-)
delete mode 100644 src/bin/stats/tests/b10-config_test.db
create mode 100644 src/bin/stats/tests/testdata/Makefile.am
create mode 100644 src/bin/stats/tests/testdata/b10-config.db
-----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index af350a8..8f324ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1039,6 +1039,7 @@ AC_CONFIG_FILES([Makefile
src/bin/zonemgr/tests/Makefile
src/bin/stats/Makefile
src/bin/stats/tests/Makefile
+ src/bin/stats/tests/testdata/Makefile
src/bin/usermgr/Makefile
src/bin/tests/Makefile
src/lib/Makefile
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index afce9e0..493754b 100755
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -101,6 +101,45 @@ def get_spec_defaults(spec):
return spec.get("item_default", None)
return dict([ (s['item_name'], _get_spec_defaults(s)) for s in spec ])
+def _accum(a, b):
+ """If the first arg is dict or list type, two values
+ would be merged and accumlated. This is for internal use."""
+
+ # If both of args are dict or list type, two
+ # values are merged.
+ if type(a) is dict and type(b) is dict:
+ return dict([ (k, _accum(v, b[k])) \
+ if k in b else (k, v) \
+ for (k, v) in a.items() ] \
+ + [ (k, v) \
+ for (k, v) in b.items() \
+ if k not in a ])
+ elif type(a) is list and type(b) is list:
+ return [ _accum(a[i], b[i]) \
+ if len(b) > i else a[i] \
+ for i in range(len(a)) ] \
+ + [ b[i] \
+ for i in range(len(b)) \
+ if len(a) <= i ]
+ # If both of args are integer or float type, two
+ # values are added.
+ elif (type(a) is int and type(b) is int) \
+ or (type(a) is float or type(b) is float):
+ return a + b
+
+ # If both of args are string type,
+ # values are compared and bigger one is returned.
+ elif type(a) is str and type(b) is str:
+ if a < b: return b
+ return a
+
+ # If the first arg is None type, the second value is returned.
+ elif a is None:
+ return b
+
+ # Nothing matches above, the first arg is returned
+ return a
+
def merge_oldnew(old, new):
"""
Merges two arguments. If old data contains the corresponding name
@@ -186,6 +225,7 @@ class Stats:
# set a absolute timestamp polling at next time
self.next_polltime = get_timestamp() + self.get_interval()
# initialized Statistics data
+ self.update_modules()
if self.update_statistics_data(
self.module_name,
self.cc_session.lname,
@@ -196,8 +236,6 @@ class Stats:
self.module_name)
# define the variable of the last time of polling
self._lasttime_poll = 0.0
- # try to do polling firstly
- self.do_polling()
def get_interval(self):
"""return the current value of 'poll-interval'"""
@@ -220,6 +258,31 @@ class Stats:
if answer:
(rcode, value) = isc.config.ccsession.parse_answer(answer)
if rcode == 0 and type(value) is list:
+ # NOTE: For example, the "show_processes" command
+ # of Boss is assumed to return the response in this
+ # format:
+ # [
+ # ...
+ # [
+ # 20061,
+ # "b10-auth",
+ # "Auth"
+ # ],
+ # [
+ # 20103,
+ # "b10-auth-2",
+ # "Auth"
+ # ]
+ # ...
+ # ]
+ # If multiple instances of the same module are
+ # running, the address names of them, which are at the
+ # third element, must be also same. Thus, the value of
+ # the third element of each outer element is read here
+ # for counting multiple instances. This is a
+ # workaround for counting the instances. This should
+ # be fixed in another proper way in the future
+ # release.
modules = [ v[2] if type(v) is list and len(v) > 2 \
else None for v in value ]
# start requesting each module to collect statistics data
@@ -256,6 +319,7 @@ class Stats:
pass
# update statistics data
+ self.update_modules()
while len(_statistics_data) > 0:
(_module_name, _lname, _args) = _statistics_data.pop(0)
if self.update_statistics_data(_module_name, _lname, _args):
@@ -299,8 +363,8 @@ class Stats:
while self.running:
_check_command()
now = get_timestamp()
- if self.get_interval() > 0 and now >= self.next_polltime:
- intval = self.get_interval()
+ intval = self.get_interval()
+ if intval > 0 and now >= self.next_polltime:
# decide the next polling timestamp
self.next_polltime += intval
# adjust next time
@@ -380,7 +444,7 @@ class Stats:
module. If it can't find specified statistics data, it raises
StatsError.
"""
- self.update_statistics_data()
+ self.update_modules()
if owner and name:
try:
return {owner:{name:self.statistics_data[owner][name]}}
@@ -422,47 +486,24 @@ class Stats:
# interfaces aren't changed in this fix.
def _accum_bymodule(statistics_data_bymid):
- # This is an internal function for the superordinate
- # function. It accumulates statistics data of each module id by
- # module. It returns the accumulation result.
- def _accum(a, b):
- # If the first arg is dict or list type, two values
- # would be merged and accumlated.
- if type(a) is dict:
- return dict([ (k, _accum(v, b[k])) \
- if k in b else (k, v) \
- for (k, v) in a.items() ] \
- + [ (k, v) \
- for (k, v) in b.items() \
- if k not in a ])
- elif type(a) is list:
- return [ _accum(a[i], b[i]) \
- if len(b) > i else a[i] \
- for i in range(len(a)) ] \
- + [ b[i] \
- for i in range(len(b)) \
- if len(a) <= i ]
- # If the first arg is integer or float type, two
- # values are just added.
- # FIXME: A issue might happen when consolidating
- # statistics of the multiple instances. If they have
- # different statistics data which are not for adding
- # each other, this might happen: If these are integer
- # or float, these are added each other, otherwise
- # these are overwritten into one of them.
- elif type(a) is int or type(a) is float:
- return a + b
- # If the first arg is str or other types than above,
- # then it just returns the first arg which is assumed
- # to be the newer value.
- return a
+ """This is an internal method for the superordinate
+ method. It accumulates statistics data of each module id
+ by module. It returns a accumulated result."""
+ # FIXME: A issue might happen when consolidating
+ # statistics of the multiple instances. If they have
+ # different statistics data which are not for adding each
+ # other, this might happen: If these are integer or float,
+ # these are added each other. If these are string , these
+ # are compared and consolidated into bigger one. If one
+ # of them is None type , these might be consolidated
+ # into not None-type one. Otherwise these are overwritten
+ # into one of them.
ret = {}
for data in statistics_data_bymid.values():
ret.update(_accum(data, ret))
return ret
# Firstly, it gets default statistics data in each spec file.
- self.update_modules()
statistics_data = {}
for (name, module) in self.modules.items():
value = get_spec_defaults(module.get_statistics_spec())
@@ -552,12 +593,11 @@ class Stats:
"""
handle show command
"""
- # decide if polling should be done by the the last time of
- # polling. If more than one seconds past since the last
- # request to each module, the stats module requests each
- # module statistics data and then shows the latest
- # result. Otherwise, the stats module just shows statistics
- # data which it has.
+ # decide if polling should be done based on the the last time of
+ # polling. If more than one second has passed since the last
+ # request to each module, the stats module requests each module
+ # statistics data and then shows the latest result. Otherwise,
+ # the stats module just shows statistics data which it has.
if get_timestamp() - self._lasttime_poll > 1.0:
self.do_polling()
if owner or name:
diff --git a/src/bin/stats/tests/Makefile.am b/src/bin/stats/tests/Makefile.am
index de184b3..7484e5d 100644
--- a/src/bin/stats/tests/Makefile.am
+++ b/src/bin/stats/tests/Makefile.am
@@ -1,6 +1,8 @@
+SUBDIRS = testdata .
+
PYCOVERAGE_RUN = @PYCOVERAGE_RUN@
PYTESTS = b10-stats_test.py b10-stats-httpd_test.py
-EXTRA_DIST = $(PYTESTS) test_utils.py b10-config_test.db
+EXTRA_DIST = $(PYTESTS) test_utils.py
CLEANFILES = test_utils.pyc
# If necessary (rare cases), explicitly specify paths to dynamic libraries
@@ -23,7 +25,7 @@ endif
PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/stats:$(abs_top_builddir)/src/bin/stats/tests:$(abs_top_builddir)/src/bin/msgq:$(abs_top_builddir)/src/lib/python/isc/config \
B10_FROM_SOURCE=$(abs_top_srcdir) \
BIND10_MSGQ_SOCKET_FILE=$(abs_top_builddir)/msgq_socket \
- CONFIG_TESTDATA_PATH=$(abs_top_srcdir)/src/bin/stats/tests \
+ CONFIG_TESTDATA_PATH=$(abs_top_srcdir)/src/bin/stats/tests/testdata \
B10_LOCKFILE_DIR_FROM_BUILD=$(abs_top_builddir) \
$(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \
done
diff --git a/src/bin/stats/tests/b10-config_test.db b/src/bin/stats/tests/b10-config_test.db
deleted file mode 100644
index b1d6689..0000000
--- a/src/bin/stats/tests/b10-config_test.db
+++ /dev/null
@@ -1 +0,0 @@
-{"version": 2, "Boss": {"components": {"b10-auth": {"kind": "needed", "special": "auth"}, "b10-auth-2": {"kind": "needed", "special": "auth"}}}}
diff --git a/src/bin/stats/tests/b10-stats_test.py b/src/bin/stats/tests/b10-stats_test.py
index 118aae7..c98f30c 100644
--- a/src/bin/stats/tests/b10-stats_test.py
+++ b/src/bin/stats/tests/b10-stats_test.py
@@ -121,6 +121,44 @@ class TestUtilties(unittest.TestCase):
self.assertNotEqual(stats.get_datetime(
(2011, 6, 22, 8, 23, 40, 2, 173, 0)), self.const_datetime)
+ def test__accum(self):
+ self.assertEqual(stats._accum(None, None), None)
+ self.assertEqual(stats._accum(None, "b"), "b")
+ self.assertEqual(stats._accum("a", None), "a")
+ self.assertEqual(stats._accum(1, 2), 3)
+ self.assertEqual(stats._accum(0.5, 0.3), 0.8)
+ self.assertEqual(stats._accum('aa','bb'), 'bb')
+ self.assertEqual(stats._accum('1970-01-01T09:00:00Z','2012-08-09T09:33:31Z'),
+ '2012-08-09T09:33:31Z')
+ self.assertEqual(stats._accum(
+ [1, 2, 3], [4, 5]), [5, 7, 3])
+ self.assertEqual(stats._accum(
+ [4, 5], [1, 2, 3]), [5, 7, 3])
+ self.assertEqual(stats._accum(
+ [1, 2, 3], [None, 5, 6]), [1, 7, 9])
+ self.assertEqual(stats._accum(
+ [None, 5, 6], [1, 2, 3]), [1, 7, 9])
+ self.assertEqual(stats._accum(
+ [1, 2, 3], [None, None, None, None]), [1,2,3,None])
+ self.assertEqual(stats._accum(
+ [[1,2],3],[[],5,6]), [[1,2],8,6])
+ self.assertEqual(stats._accum(
+ {'one': 1, 'two': 2, 'three': 3},
+ {'one': 4, 'two': 5}),
+ {'one': 5, 'two': 7, 'three': 3})
+ self.assertEqual(stats._accum(
+ {'one': 1, 'two': 2, 'three': 3},
+ {'four': 4, 'five': 5}),
+ {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5})
+ self.assertEqual(stats._accum(
+ {'one': [1, 2], 'two': [3, None, 5], 'three': [None, 3, None]},
+ {'one': [2], 'two': [4, 5], 'three': [None, None, None], 'four': 'FOUR'}),
+ {'one':[3,2], 'two':[7,5,5], 'three':[None,3,None], 'four': 'FOUR'})
+ self.assertEqual(stats._accum(
+ [ {'one': 1, 'two': 2, 'three': 3}, {'four': 4, 'five': 5, 'six': 6} ],
+ [ {}, {'four': 1, 'five': 2, 'six': 3} ]),
+ [ {'one': 1, 'two': 2, 'three': 3}, {'four': 5, 'five': 7, 'six': 9} ])
+
def test_merge_oldnre(self):
self.assertEqual(stats.merge_oldnew(1, 2), 2)
self.assertEqual(stats.merge_oldnew(0.5, 0.3), 0.3)
@@ -479,6 +517,7 @@ class TestStats(unittest.TestCase):
def test_update_statistics_data_pt2(self):
"""test for named_set-type statistics"""
self.stats = stats.Stats()
+ self.stats.do_polling()
_test_exp1 = {
'test10.example': {
'queries.tcp': 5,
@@ -567,6 +606,7 @@ class TestStats(unittest.TestCase):
def test_update_statistics_data_withmid(self):
self.stats = stats.Stats()
+ self.stats.do_polling()
# samples of query number
bar1_tcp = 1001
bar2_tcp = 2001
@@ -576,9 +616,11 @@ class TestStats(unittest.TestCase):
list_auth = [ self.base.auth.server,
self.base.auth2.server ]
sum_qtcp = 0
- for a in list_auth: sum_qtcp += a.queries_tcp
+ for a in list_auth:
+ sum_qtcp += a.queries_tcp
sum_qudp = 0
- for a in list_auth: sum_qudp += a.queries_udp
+ for a in list_auth:
+ sum_qudp += a.queries_udp
self.stats.update_statistics_data('Auth', "bar1 at foo",
{'queries.tcp':bar1_tcp})
self.assertTrue('Auth' in self.stats.statistics_data)
@@ -588,8 +630,6 @@ class TestStats(unittest.TestCase):
self.assertTrue('Auth' in self.stats.statistics_data_bymid)
self.assertTrue('bar1 at foo' in self.stats.statistics_data_bymid['Auth'])
self.assertTrue('queries.tcp' in self.stats.statistics_data_bymid['Auth']['bar1 at foo'])
- self.assertEqual(self.stats.statistics_data_bymid['Auth']['bar1 at foo']['queries.tcp'],
- bar1_tcp)
self.assertEqual(self.stats.statistics_data_bymid['Auth']['bar1 at foo'],
{'queries.tcp': bar1_tcp})
# check consolidation of statistics data even if there is
@@ -603,7 +643,6 @@ class TestStats(unittest.TestCase):
self.assertTrue('Auth' in self.stats.statistics_data_bymid)
self.assertTrue('bar1 at foo' in self.stats.statistics_data_bymid['Auth'])
self.assertTrue('queries.tcp' in self.stats.statistics_data_bymid['Auth']['bar1 at foo'])
- self.assertEqual(self.stats.statistics_data_bymid['Auth']['bar1 at foo']['queries.tcp'], bar1_tcp)
self.assertEqual(self.stats.statistics_data_bymid['Auth']['bar1 at foo'],
{'queries.tcp': bar1_tcp})
self.assertEqual(self.stats.statistics_data_bymid['Auth']['bar2 at foo'],
@@ -739,7 +778,7 @@ class TestStats(unittest.TestCase):
}}))
self.assertEqual(self.stats.command_show(owner='Auth', name='queries.udp'),
isc.config.create_answer(
- 0, {'Auth': {'queries.udp':sum_qudp}}))
+ 0, {'Auth': {'queries.udp': sum_qudp}}))
self.assertEqual(self.stats.command_show(owner='Auth', name='queries.perzone'),
isc.config.create_answer(
0, {'Auth': {'queries.perzone': [{ 'zonename': 'test1.example',
@@ -762,11 +801,11 @@ class TestStats(unittest.TestCase):
0, {'Stats': {'timestamp':self.const_timestamp}}))
stats.get_datetime = orig_get_datetime
stats.get_timestamp = orig_get_timestamp
- self.stats.mccs.specification = isc.config.module_spec.ModuleSpec(
+ self.stats.modules[self.stats.module_name] = isc.config.module_spec.ModuleSpec(
{ "module_name": self.stats.module_name,
"statistics": [] } )
self.assertRaises(
- stats.StatsError, self.stats.command_show, owner='Foo', name='bar')
+ stats.StatsError, self.stats.command_show, owner=self.stats.module_name, name='bar')
def test_command_showchema(self):
self.stats = stats.Stats()
@@ -1090,8 +1129,8 @@ class TestStats(unittest.TestCase):
stat = stats_server.server
stats_server.run()
self.assertEqual(
- send_command('status', 'Stats'),
- (0, "Stats is up. (PID " + str(os.getpid()) + ")"))
+ send_command('show', 'Stats'),
+ (0, stat.statistics_data))
# check statistics data of 'Boss'
boss = self.base.boss.server
self.assertEqual(
@@ -1107,12 +1146,11 @@ class TestStats(unittest.TestCase):
for i in list_auth:
auth = getattr(self.base,"auth"+i).server
for s in stat.statistics_data_bymid['Auth'].values():
- for t in s.values():
- self.assertEqual(
- s, {'queries.perzone': auth.queries_per_zone,
- 'nds_queries.perzone': auth.nds_queries_per_zone,
- 'queries.tcp': auth.queries_tcp,
- 'queries.udp': auth.queries_udp})
+ self.assertEqual(
+ s, {'queries.perzone': auth.queries_per_zone,
+ 'nds_queries.perzone': auth.nds_queries_per_zone,
+ 'queries.tcp': auth.queries_tcp,
+ 'queries.udp': auth.queries_udp})
n = len(stat.statistics_data_bymid['Auth'])
self.assertEqual(n, len(list_auth))
# check consolidation of statistics data of the auth
diff --git a/src/bin/stats/tests/test_utils.py b/src/bin/stats/tests/test_utils.py
index bfd3228..f8abb57 100644
--- a/src/bin/stats/tests/test_utils.py
+++ b/src/bin/stats/tests/test_utils.py
@@ -125,7 +125,7 @@ class MockCfgmgr:
def __init__(self):
self._started = threading.Event()
self.cfgmgr = isc.config.cfgmgr.ConfigManager(
- os.environ['CONFIG_TESTDATA_PATH'], "b10-config_test.db")
+ os.environ['CONFIG_TESTDATA_PATH'], "b10-config.db")
self.cfgmgr.read_config()
def run(self):
diff --git a/src/bin/stats/tests/testdata/Makefile.am b/src/bin/stats/tests/testdata/Makefile.am
new file mode 100644
index 0000000..8f9da09
--- /dev/null
+++ b/src/bin/stats/tests/testdata/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = b10-config.db
diff --git a/src/bin/stats/tests/testdata/b10-config.db b/src/bin/stats/tests/testdata/b10-config.db
new file mode 100644
index 0000000..2f89b98
--- /dev/null
+++ b/src/bin/stats/tests/testdata/b10-config.db
@@ -0,0 +1,14 @@
+{ "version": 2,
+ "Boss": {
+ "components": {
+ "b10-auth": {
+ "kind": "needed",
+ "special": "auth"
+ },
+ "b10-auth-2": {
+ "kind": "needed",
+ "special": "auth"
+ }
+ }
+ }
+}
More information about the bind10-changes
mailing list