|
@@ -24,7 +24,7 @@ import stats
|
|
import isc.cc.session
|
|
import isc.cc.session
|
|
from test_utils import BaseModules, ThreadingServerManager, MyStats, send_command, TIMEOUT_SEC
|
|
from test_utils import BaseModules, ThreadingServerManager, MyStats, send_command, TIMEOUT_SEC
|
|
|
|
|
|
-# set test name for logger
|
|
|
|
|
|
+# set test name for logger
|
|
isc.log.init("b10-stats_test")
|
|
isc.log.init("b10-stats_test")
|
|
|
|
|
|
class TestUtilties(unittest.TestCase):
|
|
class TestUtilties(unittest.TestCase):
|
|
@@ -205,19 +205,19 @@ class TestStats(unittest.TestCase):
|
|
self.base.boss.server._started.wait()
|
|
self.base.boss.server._started.wait()
|
|
self.assertEqual(
|
|
self.assertEqual(
|
|
send_command(
|
|
send_command(
|
|
- 'show', 'Stats',
|
|
|
|
|
|
+ 'show', 'Stats',
|
|
params={ 'owner' : 'Boss',
|
|
params={ 'owner' : 'Boss',
|
|
'name' : 'boot_time' }),
|
|
'name' : 'boot_time' }),
|
|
(0, '2011-06-22T08:14:08Z'))
|
|
(0, '2011-06-22T08:14:08Z'))
|
|
self.assertEqual(
|
|
self.assertEqual(
|
|
send_command(
|
|
send_command(
|
|
- 'set', 'Stats',
|
|
|
|
|
|
+ 'set', 'Stats',
|
|
params={ 'owner' : 'Boss',
|
|
params={ 'owner' : 'Boss',
|
|
'data' : { 'boot_time' : '2012-06-22T18:24:08Z' } }),
|
|
'data' : { 'boot_time' : '2012-06-22T18:24:08Z' } }),
|
|
(0, None))
|
|
(0, None))
|
|
self.assertEqual(
|
|
self.assertEqual(
|
|
send_command(
|
|
send_command(
|
|
- 'show', 'Stats',
|
|
|
|
|
|
+ 'show', 'Stats',
|
|
params={ 'owner' : 'Boss',
|
|
params={ 'owner' : 'Boss',
|
|
'name' : 'boot_time' }),
|
|
'name' : 'boot_time' }),
|
|
(0, '2012-06-22T18:24:08Z'))
|
|
(0, '2012-06-22T18:24:08Z'))
|
|
@@ -267,7 +267,7 @@ class TestStats(unittest.TestCase):
|
|
self.assertTrue('item_description' in item)
|
|
self.assertTrue('item_description' in item)
|
|
if len(item) == 7:
|
|
if len(item) == 7:
|
|
self.assertTrue('item_format' in item)
|
|
self.assertTrue('item_format' in item)
|
|
-
|
|
|
|
|
|
+
|
|
self.assertEqual(
|
|
self.assertEqual(
|
|
send_command('__UNKNOWN__', 'Stats'),
|
|
send_command('__UNKNOWN__', 'Stats'),
|
|
(1, "Unknown command: '__UNKNOWN__'"))
|
|
(1, "Unknown command: '__UNKNOWN__'"))
|
|
@@ -340,13 +340,13 @@ class TestStats(unittest.TestCase):
|
|
self.assertEqual(self.stats.command_status(),
|
|
self.assertEqual(self.stats.command_status(),
|
|
isc.config.create_answer(
|
|
isc.config.create_answer(
|
|
0, "Stats is up. (PID " + str(os.getpid()) + ")"))
|
|
0, "Stats is up. (PID " + str(os.getpid()) + ")"))
|
|
-
|
|
|
|
|
|
+
|
|
def test_command_shutdown(self):
|
|
def test_command_shutdown(self):
|
|
self.stats.running = True
|
|
self.stats.running = True
|
|
self.assertEqual(self.stats.command_shutdown(),
|
|
self.assertEqual(self.stats.command_shutdown(),
|
|
isc.config.create_answer(0))
|
|
isc.config.create_answer(0))
|
|
self.assertFalse(self.stats.running)
|
|
self.assertFalse(self.stats.running)
|
|
-
|
|
|
|
|
|
+
|
|
def test_command_show(self):
|
|
def test_command_show(self):
|
|
self.assertEqual(self.stats.command_show(owner='Foo', name=None),
|
|
self.assertEqual(self.stats.command_show(owner='Foo', name=None),
|
|
isc.config.create_answer(
|
|
isc.config.create_answer(
|
|
@@ -380,7 +380,7 @@ class TestStats(unittest.TestCase):
|
|
"statistics": [] } )
|
|
"statistics": [] } )
|
|
self.assertRaises(
|
|
self.assertRaises(
|
|
stats.StatsError, self.stats.command_show, owner='Foo', name='bar')
|
|
stats.StatsError, self.stats.command_show, owner='Foo', name='bar')
|
|
-
|
|
|
|
|
|
+
|
|
def test_command_showchema(self):
|
|
def test_command_showchema(self):
|
|
(rcode, value) = isc.config.ccsession.parse_answer(
|
|
(rcode, value) = isc.config.ccsession.parse_answer(
|
|
self.stats.command_showschema())
|
|
self.stats.command_showschema())
|