summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestServer/TestPlugins
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py21
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py22
2 files changed, 13 insertions, 30 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
index a7a6b3d6e..a9346156c 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
@@ -18,27 +18,6 @@ from common import *
from TestPlugin import TestXMLFileBacked, TestPlugin, TestConnector
-class TestPackedDigitRange(Bcfg2TestCase):
- def test_includes(self):
- # tuples of (range description, numbers that are included,
- # numebrs that are excluded)
- tests = [("1-3", [1, "2", 3], [4]),
- ("1", [1], [0, "2"]),
- ("10-11", [10, 11], [0, 1]),
- ("9-9", [9], [8, 10]),
- ("0-100", [0, 10, 99, 100], []),
- ("1,3,5", [1, 3, 5], [0, 2, 4, 6]),
- ("1-5,7", [1, 3, 5, 7], [0, 6, 8]),
- ("1-5,7,9-11", [1, 3, 5, 7, 9, 11], [0, 6, 8, 12]),
- ("852-855,321-497,763", [852, 855, 321, 400, 497, 763], [])]
- for rng, inc, exc in tests:
- r = PackedDigitRange(rng)
- for test in inc:
- self.assertTrue(r.includes(test))
- for test in exc:
- self.assertFalse(r.includes(test))
-
-
class TestPatternMap(Bcfg2TestCase):
def test_ranges(self):
""" test processing NameRange patterns """
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
index f627e4465..69ea45de6 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py
@@ -20,7 +20,7 @@ while path != "/":
path = os.path.dirname(path)
from common import *
from TestPlugin import TestXMLFileBacked, TestMetadata as _TestMetadata, \
- TestStatistics, TestDatabaseBacked
+ TestClientRunHooks, TestDatabaseBacked
def get_clients_test_tree():
@@ -198,6 +198,7 @@ if HAS_DJANGO or can_skip:
class TestXMLMetadataConfig(TestXMLFileBacked):
test_obj = XMLMetadataConfig
+ path = os.path.join(datastore, 'Metadata', 'clients.xml')
def get_obj(self, basefile="clients.xml", core=None, watch_clients=False):
self.metadata = get_metadata_object(core=core,
@@ -326,7 +327,7 @@ class TestXMLMetadataConfig(TestXMLFileBacked):
"clients.xml"),
"<test/>")
- @patch('Bcfg2.Server.Plugins.Metadata.locked', Mock(return_value=False))
+ @patch('Bcfg2.Utils.locked', Mock(return_value=False))
@patch('fcntl.lockf', Mock())
@patch('os.open')
@patch('os.fdopen')
@@ -462,7 +463,7 @@ class TestClientMetadata(Bcfg2TestCase):
self.assertFalse(cm.inGroup("group3"))
-class TestMetadata(_TestMetadata, TestStatistics, TestDatabaseBacked):
+class TestMetadata(_TestMetadata, TestClientRunHooks, TestDatabaseBacked):
test_obj = Metadata
use_db = False
@@ -494,7 +495,7 @@ class TestMetadata(_TestMetadata, TestStatistics, TestDatabaseBacked):
metadata = self.get_obj(core=core)
self.assertIsInstance(metadata, Bcfg2.Server.Plugin.Plugin)
self.assertIsInstance(metadata, Bcfg2.Server.Plugin.Metadata)
- self.assertIsInstance(metadata, Bcfg2.Server.Plugin.Statistics)
+ self.assertIsInstance(metadata, Bcfg2.Server.Plugin.ClientRunHooks)
self.assertIsInstance(metadata.clients_xml, XMLMetadataConfig)
self.assertIsInstance(metadata.groups_xml, XMLMetadataConfig)
self.assertIsInstance(metadata.query, MetadataQuery)
@@ -1216,17 +1217,16 @@ class TestMetadata(_TestMetadata, TestStatistics, TestDatabaseBacked):
@patch("Bcfg2.Server.Plugins.Metadata.XMLMetadataConfig.load_xml", Mock())
@patch("Bcfg2.Server.Plugins.Metadata.Metadata.update_client")
- def test_process_statistics(self, mock_update_client):
+ def test_end_statistics(self, mock_update_client):
metadata = self.load_clients_data(metadata=self.load_groups_data())
md = Mock()
md.hostname = "client6"
- metadata.process_statistics(md, None)
- mock_update_client.assert_called_with(md.hostname,
- dict(auth='cert'))
+ metadata.end_statistics(md)
+ mock_update_client.assert_called_with(md.hostname, dict(auth='cert'))
mock_update_client.reset_mock()
md.hostname = "client5"
- metadata.process_statistics(md, None)
+ metadata.end_statistics(md)
self.assertFalse(mock_update_client.called)
def test_viz(self):
@@ -1503,6 +1503,10 @@ class TestMetadata_NoClientsXML(TestMetadataBase):
def test_handle_clients_xml_event(self):
pass
+ def test_end_statistics(self):
+ # bootstrap mode, which is what is being tested here, doesn't
+ # work without clients.xml
+ pass
class TestMetadata_ClientsXML(TestMetadataBase):
""" test Metadata with a clients.xml. """