aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/core
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/benchmark/core')
-rw-r--r--tests/unit/benchmark/core/test_task.py47
1 files changed, 25 insertions, 22 deletions
diff --git a/tests/unit/benchmark/core/test_task.py b/tests/unit/benchmark/core/test_task.py
index e3917b5b2..bed0bb6d8 100644
--- a/tests/unit/benchmark/core/test_task.py
+++ b/tests/unit/benchmark/core/test_task.py
@@ -70,10 +70,10 @@ class TaskTestCase(unittest.TestCase):
'network_name': 'mgmt',
},
'xe0': {
- 'network_name': 'private_0',
+ 'network_name': 'uplink_0',
},
'xe1': {
- 'network_name': 'public_0',
+ 'network_name': 'downlink_0',
},
},
},
@@ -82,11 +82,11 @@ class TaskTestCase(unittest.TestCase):
'mgmt': {
'network_name': 'mgmt',
},
- 'private_0': {
- 'network_name': 'private_0',
+ 'uplink_0': {
+ 'network_name': 'uplink_0',
},
- 'public_0': {
- 'network_name': 'public_0',
+ 'downlink_0': {
+ 'network_name': 'downlink_0',
},
},
},
@@ -100,15 +100,15 @@ class TaskTestCase(unittest.TestCase):
},
{},
{
- 'name': 'private_0',
+ 'name': 'uplink_0',
'subnet_cidr': '10.20.0.0/16',
},
{
- 'name': 'public_0',
+ 'name': 'downlink_0',
'segmentation_id': '1001',
},
{
- 'name': 'private_1',
+ 'name': 'uplink_1',
},
])
@@ -116,9 +116,9 @@ class TaskTestCase(unittest.TestCase):
expected_get_network_calls = 6
expected = {
'mgmt': {'name': 'mgmt', 'network_type': 'flat'},
- 'private_0': {'name': 'private_0', 'subnet_cidr': '10.20.0.0/16'},
- 'private_1': {'name': 'private_1'},
- 'public_0': {'name': 'public_0', 'segmentation_id': '1001'},
+ 'uplink_0': {'name': 'uplink_0', 'subnet_cidr': '10.20.0.0/16'},
+ 'uplink_1': {'name': 'uplink_1'},
+ 'downlink_0': {'name': 'downlink_0', 'segmentation_id': '1001'},
}
networks = task.get_networks_from_nodes(nodes)
@@ -165,12 +165,12 @@ class TaskTestCase(unittest.TestCase):
result = t._check_precondition(cfg)
self.assertTrue(result)
- @mock.patch('yardstick.benchmark.core.task.os.environ')
- def test_parse_suite_no_constraint_no_args(self, mock_environ):
+ def test_parse_suite_no_constraint_no_args(self):
SAMPLE_SCENARIO_PATH = "no_constraint_no_args_scenario_sample.yaml"
t = task.TaskParser(self._get_file_abspath(SAMPLE_SCENARIO_PATH))
- mock_environ.get.side_effect = ['huawei-pod1', 'compass']
- task_files, task_args, task_args_fnames = t.parse_suite()
+ with mock.patch('yardstick.benchmark.core.task.os.environ',
+ new={'NODE_NAME': 'huawei-pod1', 'INSTALLER_TYPE': 'compass'}):
+ task_files, task_args, task_args_fnames = t.parse_suite()
print("files=%s, args=%s, fnames=%s" % (task_files, task_args,
task_args_fnames))
self.assertEqual(task_files[0], self.change_to_abspath(
@@ -186,8 +186,9 @@ class TaskTestCase(unittest.TestCase):
def test_parse_suite_no_constraint_with_args(self, mock_environ):
SAMPLE_SCENARIO_PATH = "no_constraint_with_args_scenario_sample.yaml"
t = task.TaskParser(self._get_file_abspath(SAMPLE_SCENARIO_PATH))
- mock_environ.get.side_effect = ['huawei-pod1', 'compass']
- task_files, task_args, task_args_fnames = t.parse_suite()
+ with mock.patch('yardstick.benchmark.core.task.os.environ',
+ new={'NODE_NAME': 'huawei-pod1', 'INSTALLER_TYPE': 'compass'}):
+ task_files, task_args, task_args_fnames = t.parse_suite()
print("files=%s, args=%s, fnames=%s" % (task_files, task_args,
task_args_fnames))
self.assertEqual(task_files[0], self.change_to_abspath(
@@ -204,8 +205,9 @@ class TaskTestCase(unittest.TestCase):
def test_parse_suite_with_constraint_no_args(self, mock_environ):
SAMPLE_SCENARIO_PATH = "with_constraint_no_args_scenario_sample.yaml"
t = task.TaskParser(self._get_file_abspath(SAMPLE_SCENARIO_PATH))
- mock_environ.get.side_effect = ['huawei-pod1', 'compass']
- task_files, task_args, task_args_fnames = t.parse_suite()
+ with mock.patch('yardstick.benchmark.core.task.os.environ',
+ new={'NODE_NAME': 'huawei-pod1', 'INSTALLER_TYPE': 'compass'}):
+ task_files, task_args, task_args_fnames = t.parse_suite()
print("files=%s, args=%s, fnames=%s" % (task_files, task_args,
task_args_fnames))
self.assertEqual(task_files[0], self.change_to_abspath(
@@ -221,8 +223,9 @@ class TaskTestCase(unittest.TestCase):
def test_parse_suite_with_constraint_with_args(self, mock_environ):
SAMPLE_SCENARIO_PATH = "with_constraint_with_args_scenario_sample.yaml"
t = task.TaskParser(self._get_file_abspath(SAMPLE_SCENARIO_PATH))
- mock_environ.get.side_effect = ['huawei-pod1', 'compass']
- task_files, task_args, task_args_fnames = t.parse_suite()
+ with mock.patch('yardstick.benchmark.core.task.os.environ',
+ new={'NODE_NAME': 'huawei-pod1', 'INSTALLER_TYPE': 'compass'}):
+ task_files, task_args, task_args_fnames = t.parse_suite()
print("files=%s, args=%s, fnames=%s" % (task_files, task_args,
task_args_fnames))
self.assertEqual(task_files[0], self.change_to_abspath(