diff --git a/bareon/tests_functional/__init__.py b/bareon/tests_functional/__init__.py index e69de29..1f79a98 100644 --- a/bareon/tests_functional/__init__.py +++ b/bareon/tests_functional/__init__.py @@ -0,0 +1,23 @@ +# +# Copyright 2016 Cray Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pkg_resources +import ramdisk_func_test +import unittest2 + + +class TestCase(ramdisk_func_test.TestCaseMixin, unittest2.TestCase): + _rft_template_path = pkg_resources.resource_filename( + __name__, 'node_templates') diff --git a/bareon/tests_functional/node_templates/__init__.py b/bareon/tests_functional/node_templates/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/bareon/tests_functional/test_data_retention.py b/bareon/tests_functional/test_data_retention.py index ee6a9c9..0aa96e0 100644 --- a/bareon/tests_functional/test_data_retention.py +++ b/bareon/tests_functional/test_data_retention.py @@ -13,22 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest2 -import utils - -from ramdisk_func_test.environment import Environment +from bareon import tests_functional +from bareon.tests_functional import utils -class DataRetentionTestCase(unittest2.TestCase): - - @classmethod - def setUpClass(cls): - super(DataRetentionTestCase, cls).setUpClass() - cls.env = Environment( - node_templates="./bareon/tests_functional/node_templates" - ) - cls.env.setupclass() - +class DataRetentionTestCase(tests_functional.TestCase): def setUp(self): super(DataRetentionTestCase, self).setUp() self.images = [ @@ -106,15 +95,6 @@ Number Start End Size File system Flags 1 0.00B 106MB 106MB ext4 """ - def tearDown(self): - super(DataRetentionTestCase, self).tearDown() - self.env.teardown() - - @classmethod - def tearDownClass(cls): - super(DataRetentionTestCase, cls).tearDownClass() - cls.env.teardownclass() - def _assert_vda_equal_to_goldenimage(self, node): self._assert_vda_root_equal_to_goldenimage(node) self._assert_vda_usr_equal_to_goldenimage(node) diff --git a/bareon/tests_functional/test_lvm.py b/bareon/tests_functional/test_lvm.py index 62d8401..cfe5ebe 100644 --- a/bareon/tests_functional/test_lvm.py +++ b/bareon/tests_functional/test_lvm.py @@ -13,31 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest2 import utils -from ramdisk_func_test.environment import Environment +from bareon import tests_functional -class LvmTestCase(unittest2.TestCase): - - @classmethod - def setUpClass(cls): - super(LvmTestCase, cls).setUpClass() - cls.env = Environment( - node_templates="./bareon/tests_functional/node_templates" - ) - cls.env.setupclass() - - def tearDown(self): - super(LvmTestCase, self).tearDown() - self.env.teardown() - - @classmethod - def tearDownClass(cls): - super(LvmTestCase, cls).tearDownClass() - cls.env.teardownclass() - +class LvmTestCase(tests_functional.TestCase): def test_multi_volume_multi_group(self): deploy_conf = { "images": [ diff --git a/bareon/tests_functional/test_nailgun.py b/bareon/tests_functional/test_nailgun.py index 3b3ef4f..6d26100 100644 --- a/bareon/tests_functional/test_nailgun.py +++ b/bareon/tests_functional/test_nailgun.py @@ -15,10 +15,9 @@ from copy import deepcopy -import unittest2 import utils -from ramdisk_func_test.environment import Environment +from bareon import tests_functional PROVISION_SAMPLE_DATA = { @@ -234,25 +233,7 @@ PROVISION_SAMPLE_DATA = { } -class TestNailgun(unittest2.TestCase): - - @classmethod - def setUpClass(cls): - super(TestNailgun, cls).setUpClass() - cls.env = Environment( - node_templates="./bareon/tests_functional/node_templates" - ) - cls.env.setupclass() - - def tearDown(self): - super(TestNailgun, self).tearDown() - self.env.teardown() - - @classmethod - def tearDownClass(cls): - super(TestNailgun, cls).tearDownClass() - cls.env.teardownclass() - +class TestNailgun(tests_functional.TestCase): def test_provision(self): data = deepcopy(PROVISION_SAMPLE_DATA) data['ks_meta']['image_data']['/']['uri'] = self.env.get_url_for_image( diff --git a/bareon/tests_functional/test_provisioning.py b/bareon/tests_functional/test_provisioning.py index 828b19c..8af02db 100644 --- a/bareon/tests_functional/test_provisioning.py +++ b/bareon/tests_functional/test_provisioning.py @@ -14,31 +14,13 @@ # limitations under the License. import json -import unittest2 import utils import uuid -from ramdisk_func_test.environment import Environment +from bareon import tests_functional -class SingleProvisioningTestCase(unittest2.TestCase): - @classmethod - def setUpClass(cls): - super(SingleProvisioningTestCase, cls).setUpClass() - cls.env = Environment( - node_templates="./bareon/tests_functional/node_templates" - ) - cls.env.setupclass() - - def tearDown(self): - super(SingleProvisioningTestCase, self).tearDown() - self.env.teardown() - - @classmethod - def tearDownClass(cls): - super(SingleProvisioningTestCase, cls).tearDownClass() - cls.env.teardownclass() - +class SingleProvisioningTestCase(tests_functional.TestCase): def test_provision_two_disks_swift(self): DEPLOY_DRIVER = 'swift' deploy_conf = { @@ -208,24 +190,7 @@ Number Start End Size File system Name Flags utils.assertNoDiff(expected, actual) -class MultipleProvisioningTestCase(unittest2.TestCase): - @classmethod - def setUpClass(cls): - super(MultipleProvisioningTestCase, cls).setUpClass() - cls.env = Environment( - node_templates="./bareon/tests_functional/node_templates" - ) - cls.env.setupclass() - - def tearDown(self): - super(MultipleProvisioningTestCase, self).tearDown() - self.env.teardown() - - @classmethod - def tearDownClass(cls): - super(MultipleProvisioningTestCase, cls).tearDownClass() - cls.env.teardownclass() - +class MultipleProvisioningTestCase(tests_functional.TestCase): def test_multiple_provisioning(self): DEPLOY_DRIVER = 'swift' image_url = self.env.get_url_for_image( diff --git a/setup.cfg b/setup.cfg index 751d02c..177edbb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -53,9 +53,6 @@ oslo.config.opts = [pbr] autodoc_index_modules = True -# this variable is needed to avoid including files -# from other subprojects in this repository -skip_git_sdist = True [global] setup-hooks =