Browse Source

[2225_statistics] rename class name and add TEST_SPECFILE_LOCATION

Naoki Kambe 12 years ago
parent
commit
2f29fad03b

+ 1 - 0
src/lib/python/isc/statistics/tests/Makefile.am

@@ -27,5 +27,6 @@ endif
 	PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/xfrout:$(abs_top_builddir)/src/bin/xfrin:$(abs_top_builddir)/src/lib/dns/python/.libs \
 	$(LIBRARY_PATH_PLACEHOLDER) \
 	B10_FROM_BUILD=$(abs_top_builddir) \
+	TESTDATASRCDIR=$(abs_top_srcdir)/src/lib/python/isc/statistics/tests/testdata \
 	$(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \
 	done

+ 15 - 2
src/lib/python/isc/statistics/tests/counter_test.py

@@ -18,9 +18,11 @@
 import unittest
 import threading
 from datetime import timedelta
+import os
 import isc.config
 
 TEST_ZONE_NAME_STR = "example.com."
+TESTDATA_SRCDIR = os.getenv("TESTDATASRCDIR")
 
 from isc.statistics import counter
 
@@ -43,9 +45,11 @@ def start_functor(number, cycle, functor, *args):
     event.set()
     for th in threads: th.join()
 
-class TestCounter(unittest.TestCase):
+class TestBasicMethods(unittest.TestCase):
+    TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec'
+
     def setUp(self):
-        self.counter = counter.Counter()
+        self.counter = counter.init(self.TEST_SPECFILE_LOCATION)
         self._statistics_data = {}
         self._start_time = {}
         self._counter_name = "counter"
@@ -309,5 +313,14 @@ class BaseTestCounter():
                 'socket/%s/tcp/%s' % counter_name, 2)
         self.check_dump_statistics()
 
+class TestCounter1(BaseTestCounter, unittest.TestCase):
+    TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec1.spec'
+
+class TestCounter2(BaseTestCounter, unittest.TestCase):
+    TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec2.spec'
+
+class TestCounter3(BaseTestCounter, unittest.TestCase):
+    TEST_SPECFILE_LOCATION = TESTDATA_SRCDIR + os.sep + 'test_spec3.spec'
+
 if __name__== "__main__":
     unittest.main()