Merge "NFVi Test stops after one hour even if configured context duration is longer"
[yardstick.git] / yardstick / tests / unit / benchmark / core / test_task.py
index 253e9d8..82a90b1 100644 (file)
@@ -66,7 +66,7 @@ class TaskTestCase(unittest.TestCase):
 
         mock_dispatcher.get = mock.MagicMock(return_value=[dispatcher1,
                                                            dispatcher2])
-        self.assertEqual(None, t._do_output(output_config, {}))
+        self.assertIsNone(t._do_output(output_config, {}))
 
     @mock.patch.object(task, 'Context')
     def test_parse_networks_from_nodes(self, mock_context):
@@ -264,6 +264,38 @@ class TaskTestCase(unittest.TestCase):
         actual_result = t._parse_options(options)
         self.assertEqual(expected_result, actual_result)
 
+    def test_parse_options_no_teardown(self):
+        options = {
+            'openstack': {
+                'EXTERNAL_NETWORK': '$network'
+            },
+            'nodes': ['node1', '$node'],
+            'host': '$host',
+            'contexts' : {'name': "my-context",
+                          'no_teardown': True}
+        }
+
+        t = task.Task()
+        t.outputs = {
+            'network': 'ext-net',
+            'node': 'node2',
+            'host': 'server.yardstick'
+        }
+
+        expected_result = {
+            'openstack': {
+                'EXTERNAL_NETWORK': 'ext-net'
+            },
+            'nodes': ['node1', 'node2'],
+            'host': 'server.yardstick',
+            'contexts': {'name': 'my-context',
+                         'no_teardown': True,
+                        }
+        }
+
+        actual_result = t._parse_options(options)
+        self.assertEqual(expected_result, actual_result)
+
     @mock.patch('six.moves.builtins.open', side_effect=mock.mock_open())
     @mock.patch.object(task, 'utils')
     @mock.patch('logging.root')