diff options
author | Edward MacGillivray <edward.s.macgillivray@intel.com> | 2017-08-18 10:41:03 -0700 |
---|---|---|
committer | Edward MacGillivray <edward.s.macgillivray@intel.com> | 2017-08-21 14:05:41 -0700 |
commit | b9bd7a7b582dff2a8186c58a1fc9de4a219fcb1f (patch) | |
tree | ffdcfa8814032a9e9c7efa91b7b2a5d318094c9c | |
parent | 4cd35297332c1fbfa114ff8b237ee3d4864f7498 (diff) |
Refactor to make file sys more like class inheritance
Change-Id: I5471d2e894ca78407a57f3ba01202264c69ad174
Signed-off-by: Edward MacGillivray <edward.s.macgillivray@intel.com>
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/__init__.py | 0 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/ovs_sample_password.yaml (renamed from tests/unit/benchmark/contexts/ovs_sample_password.yaml) | 0 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/ovs_sample_ssh_key.yaml (renamed from tests/unit/benchmark/contexts/ovs_sample_ssh_key.yaml) | 0 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/ovs_sample_write_to_file.txt (renamed from tests/unit/benchmark/contexts/ovs_sample_write_to_file.txt) | 0 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/sriov_sample_password.yaml (renamed from tests/unit/benchmark/contexts/sriov_sample_password.yaml) | 0 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/sriov_sample_ssh_key.yaml (renamed from tests/unit/benchmark/contexts/sriov_sample_ssh_key.yaml) | 0 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/sriov_sample_write_to_file.txt (renamed from tests/unit/benchmark/contexts/sriov_sample_write_to_file.txt) | 0 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/test_ovsdpdk.py (renamed from tests/unit/benchmark/contexts/test_ovsdpdk.py) | 10 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/standalone/test_sriov.py (renamed from tests/unit/benchmark/contexts/test_sriov.py) | 14 | ||||
-rw-r--r-- | tests/unit/benchmark/contexts/test_standalone.py | 17 | ||||
-rw-r--r-- | yardstick/benchmark/contexts/standalone/__init__.py (renamed from yardstick/benchmark/contexts/standalone.py) | 0 | ||||
-rw-r--r-- | yardstick/benchmark/contexts/standalone/ovsdpdk.py (renamed from yardstick/benchmark/contexts/ovsdpdk.py) | 0 | ||||
-rw-r--r-- | yardstick/benchmark/contexts/standalone/sriov.py (renamed from yardstick/benchmark/contexts/sriov.py) | 0 |
13 files changed, 23 insertions, 18 deletions
diff --git a/tests/unit/benchmark/contexts/standalone/__init__.py b/tests/unit/benchmark/contexts/standalone/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/unit/benchmark/contexts/standalone/__init__.py diff --git a/tests/unit/benchmark/contexts/ovs_sample_password.yaml b/tests/unit/benchmark/contexts/standalone/ovs_sample_password.yaml index b1da1ea9f..b1da1ea9f 100644 --- a/tests/unit/benchmark/contexts/ovs_sample_password.yaml +++ b/tests/unit/benchmark/contexts/standalone/ovs_sample_password.yaml diff --git a/tests/unit/benchmark/contexts/ovs_sample_ssh_key.yaml b/tests/unit/benchmark/contexts/standalone/ovs_sample_ssh_key.yaml index 896ec33bb..896ec33bb 100644 --- a/tests/unit/benchmark/contexts/ovs_sample_ssh_key.yaml +++ b/tests/unit/benchmark/contexts/standalone/ovs_sample_ssh_key.yaml diff --git a/tests/unit/benchmark/contexts/ovs_sample_write_to_file.txt b/tests/unit/benchmark/contexts/standalone/ovs_sample_write_to_file.txt index f0eec86f6..f0eec86f6 100644 --- a/tests/unit/benchmark/contexts/ovs_sample_write_to_file.txt +++ b/tests/unit/benchmark/contexts/standalone/ovs_sample_write_to_file.txt diff --git a/tests/unit/benchmark/contexts/sriov_sample_password.yaml b/tests/unit/benchmark/contexts/standalone/sriov_sample_password.yaml index 4f60e46d5..4f60e46d5 100644 --- a/tests/unit/benchmark/contexts/sriov_sample_password.yaml +++ b/tests/unit/benchmark/contexts/standalone/sriov_sample_password.yaml diff --git a/tests/unit/benchmark/contexts/sriov_sample_ssh_key.yaml b/tests/unit/benchmark/contexts/standalone/sriov_sample_ssh_key.yaml index faa496771..faa496771 100644 --- a/tests/unit/benchmark/contexts/sriov_sample_ssh_key.yaml +++ b/tests/unit/benchmark/contexts/standalone/sriov_sample_ssh_key.yaml diff --git a/tests/unit/benchmark/contexts/sriov_sample_write_to_file.txt b/tests/unit/benchmark/contexts/standalone/sriov_sample_write_to_file.txt index f0eec86f6..f0eec86f6 100644 --- a/tests/unit/benchmark/contexts/sriov_sample_write_to_file.txt +++ b/tests/unit/benchmark/contexts/standalone/sriov_sample_write_to_file.txt diff --git a/tests/unit/benchmark/contexts/test_ovsdpdk.py b/tests/unit/benchmark/contexts/standalone/test_ovsdpdk.py index ac25ec877..1d68384c9 100644 --- a/tests/unit/benchmark/contexts/test_ovsdpdk.py +++ b/tests/unit/benchmark/contexts/standalone/test_ovsdpdk.py @@ -13,11 +13,13 @@ # limitations under the License. from __future__ import absolute_import + import os -import mock import unittest -from yardstick.benchmark.contexts import ovsdpdk +import mock + +from yardstick.benchmark.contexts.standalone import ovsdpdk NIC_INPUT = { 'interface': {}, @@ -226,11 +228,11 @@ class OvsdpdkTestCase(unittest.TestCase): mock_ovs = mock.Mock() ssh_mock.put = mock.Mock() ovs_obj.check_output = mock.Mock(return_value=(0, "vm1")) - with mock.patch("yardstick.benchmark.contexts.ovsdpdk.time"): + with mock.patch("yardstick.benchmark.contexts.standalone.ovsdpdk.time"): self.assertIsNone(ovs_obj.setup_ovs_context(PCIS, NIC_DETAILS, DRIVER)) @mock.patch( - 'yardstick.benchmark.contexts.ovsdpdk', + 'yardstick.benchmark.contexts.standalone.ovsdpdk', return_value="Domain vm1 created from /tmp/vm_ovs.xml") def test_is_vm_created(self, NIC_INPUT): with mock.patch("yardstick.ssh.SSH") as ssh: diff --git a/tests/unit/benchmark/contexts/test_sriov.py b/tests/unit/benchmark/contexts/standalone/test_sriov.py index a8641a2eb..ea72e1bab 100644 --- a/tests/unit/benchmark/contexts/test_sriov.py +++ b/tests/unit/benchmark/contexts/standalone/test_sriov.py @@ -13,11 +13,13 @@ # limitations under the License. from __future__ import absolute_import + import os -import mock import unittest -from yardstick.benchmark.contexts import sriov +import mock + +from yardstick.benchmark.contexts.standalone import sriov NIC_INPUT = { 'interface': {}, @@ -185,7 +187,7 @@ class SriovTestCase(unittest.TestCase): nic_details['vf_pci'][i] = sriov_obj.get_vf_datas.return_value vf_pci = [[], []] vf_pci[i] = sriov_obj.get_vf_datas.return_value - with mock.patch("yardstick.benchmark.contexts.sriov.time"): + with mock.patch("yardstick.benchmark.contexts.standalone.sriov.time"): self.assertIsNotNone(sriov_obj.configure_nics_for_sriov(DRIVER, NIC_DETAILS)) def test_setup_sriov_context(self): @@ -224,7 +226,7 @@ class SriovTestCase(unittest.TestCase): mock.Mock(return_value=(0, {}, "")) ssh_mock.put = mock.Mock() sriov_obj.check_output = mock.Mock(return_value=(1, {})) - with mock.patch("yardstick.benchmark.contexts.sriov.time"): + with mock.patch("yardstick.benchmark.contexts.standalone.sriov.time"): self.assertIsNone(sriov_obj.setup_sriov_context(PCIS, nic_details, DRIVER)) def test_setup_sriov_context_vm_already_present(self): @@ -263,11 +265,11 @@ class SriovTestCase(unittest.TestCase): mock.Mock(return_value=(0, {}, "")) ssh_mock.put = mock.Mock() sriov_obj.check_output = mock.Mock(return_value=(0, "vm1")) - with mock.patch("yardstick.benchmark.contexts.sriov.time"): + with mock.patch("yardstick.benchmark.contexts.standalone.sriov.time"): self.assertIsNone(sriov_obj.setup_sriov_context(PCIS, nic_details, DRIVER)) @mock.patch( - 'yardstick.benchmark.contexts.sriov', + 'yardstick.benchmark.contexts.standalone.sriov', return_value="Domain vm1 created from /tmp/vm_sriov.xml") def test_is_vm_created(self, NIC_INPUT): with mock.patch("yardstick.ssh.SSH") as ssh: diff --git a/tests/unit/benchmark/contexts/test_standalone.py b/tests/unit/benchmark/contexts/test_standalone.py index d13e28470..b1402a1c9 100644 --- a/tests/unit/benchmark/contexts/test_standalone.py +++ b/tests/unit/benchmark/contexts/test_standalone.py @@ -18,25 +18,26 @@ # Unittest for yardstick.benchmark.contexts.standalone from __future__ import absolute_import + import os import unittest + import mock from yardstick.benchmark.contexts import standalone -from yardstick.benchmark.contexts import sriov -from yardstick.benchmark.contexts import ovsdpdk +from yardstick.benchmark.contexts.standalone import ovsdpdk, sriov MOCKS = { 'yardstick.benchmark.contexts': mock.MagicMock(), - 'yardstick.benchmark.contexts.sriov': mock.MagicMock(), - 'yardstick.benchmark.contexts.ovsdpdk': mock.MagicMock(), + 'yardstick.benchmark.contexts.standalone.sriov': mock.MagicMock(), + 'yardstick.benchmark.contexts.standalone.ovsdpdk': mock.MagicMock(), 'yardstick.benchmark.contexts.standalone': mock.MagicMock(), } -@mock.patch('yardstick.benchmark.contexts.ovsdpdk.time') +@mock.patch('yardstick.benchmark.contexts.standalone.ovsdpdk.time') @mock.patch('yardstick.benchmark.contexts.standalone.time') -@mock.patch('yardstick.benchmark.contexts.sriov.time') +@mock.patch('yardstick.benchmark.contexts.standalone.sriov.time') class StandaloneContextTestCase(unittest.TestCase): NODES_SAMPLE = "nodes_sample_new.yaml" NODES_SAMPLE_SRIOV = "nodes_sample_new_sriov.yaml" @@ -564,7 +565,7 @@ class StandaloneContextTestCase(unittest.TestCase): self.assertIsNone(self.test_context.undeploy()) def test_get_nfvi_obj_sriov(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time): - with mock.patch('yardstick.benchmark.contexts.sriov'): + with mock.patch('yardstick.benchmark.contexts.standalone.sriov'): attrs = { 'name': 'sriov', 'file': self._get_file_abspath(self.NODES_SAMPLE) @@ -589,7 +590,7 @@ class StandaloneContextTestCase(unittest.TestCase): self.assertIsNotNone(self.test_context.get_nfvi_obj()) def test_get_nfvi_obj_ovs(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time): - with mock.patch('yardstick.benchmark.contexts.ovsdpdk'): + with mock.patch('yardstick.benchmark.contexts.standalone.ovsdpdk'): attrs = { 'name': 'ovs', 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK) diff --git a/yardstick/benchmark/contexts/standalone.py b/yardstick/benchmark/contexts/standalone/__init__.py index f0ef1d560..f0ef1d560 100644 --- a/yardstick/benchmark/contexts/standalone.py +++ b/yardstick/benchmark/contexts/standalone/__init__.py diff --git a/yardstick/benchmark/contexts/ovsdpdk.py b/yardstick/benchmark/contexts/standalone/ovsdpdk.py index cf5529d89..cf5529d89 100644 --- a/yardstick/benchmark/contexts/ovsdpdk.py +++ b/yardstick/benchmark/contexts/standalone/ovsdpdk.py diff --git a/yardstick/benchmark/contexts/sriov.py b/yardstick/benchmark/contexts/standalone/sriov.py index fe27d2579..fe27d2579 100644 --- a/yardstick/benchmark/contexts/sriov.py +++ b/yardstick/benchmark/contexts/standalone/sriov.py |