From 7be65237acd7fe91a6693d9c2518a8a0c849d672 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 5 Sep 2016 17:34:34 +0200 Subject: testsuite: Only sync the database once per TestCase --- testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py | 4 ++-- testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins') diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py index f2721c9ea..5d7ed50b7 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestMetadata.py @@ -123,7 +123,7 @@ class TestClientVersions(TestDatabaseBacked): def setUp(self): TestDatabaseBacked.setUp(self) self.test_obj = ClientVersions - syncdb(TestMetadataDB) + self.syncdb(TestMetadataDB) for client, version in self.test_clients.items(): MetadataClientModel(hostname=client, version=version).save() @@ -1252,7 +1252,7 @@ class TestMetadataBase(TestMetadata): TestClientRunHooks.setUp(self) TestDatabaseBacked.setUp(self) Bcfg2.Options.setup.metadata_db = True - syncdb(TestMetadataDB) + self.syncdb(TestMetadataDB) def load_clients_data(self, metadata=None, xdata=None): if metadata is None: diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py index 32766b5c1..07d624b29 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py @@ -278,7 +278,7 @@ group: group:with:colons def test_probes_db(self): """ Set and retrieve probe data with database enabled """ Bcfg2.Options.setup.probes_db = True - syncdb(TestProbesDB) + self.syncdb(TestProbesDB) self._perform_tests() def test_allowed_cgroups(self): -- cgit v1.2.3-1-g7c22 From b90204c1ed3380671cd5f887e35fd2e74700eaee Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 5 Sep 2016 19:30:02 +0200 Subject: testsuite: Use TestDatabaseBacked for Probes, too --- testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins') diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py index 07d624b29..9729a0449 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py @@ -201,7 +201,7 @@ group-specific""" assert False, "Strange probe found in get_probe_data() return" -class TestProbes(TestPlugin): +class TestProbes(TestDatabaseBacked): test_obj = Probes test_xdata = lxml.etree.Element("test") @@ -241,7 +241,7 @@ group: group:with:colons self.datastore = None Bcfg2.Options.setup.repository = datastore - def get_obj(self): + def get_obj(self, core=None): if not Bcfg2.Options.setup.probes_db: # actually use a real datastore so we can read and write # probed.xml @@ -251,7 +251,7 @@ group: group:with:colons datadir = os.path.join(self.datastore, self.test_obj.name) if not os.path.exists(datadir): os.makedirs(datadir) - return TestPlugin.get_obj(self) + return TestPlugin.get_obj(self, core) def test__init(self): if Bcfg2.Options.setup.probes_db: -- cgit v1.2.3-1-g7c22