3 ##############################################################################
4 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 # Unittest for yardstick.benchmark.core.plugin
13 from __future__ import absolute_import
15 from os.path import dirname as dirname
18 from unittest import mock
23 from yardstick.benchmark.core import plugin
29 # self.input_file = ('plugin/sample_config.yaml',)
31 os.path.join(os.path.abspath(
32 dirname(dirname(dirname(dirname(dirname(__file__)))))),
33 'plugin/sample_config.yaml')]
36 @mock.patch('yardstick.benchmark.core.plugin.ssh')
37 class pluginTestCase(unittest.TestCase):
42 def test_install(self, mock_ssh):
44 mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
48 self.assertEqual(self.result, expected_result)
50 def test_remove(self, mock_ssh):
52 mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
56 self.assertEqual(self.result, expected_result)
58 def test_install_setup_run(self, mock_ssh):
60 mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
69 plugin_name = plugins.get("name")
70 p._install_setup(plugin_name, deployment)
71 self.assertIsNotNone(p.client)
75 self.assertEqual(self.result, expected_result)
77 def test_remove_setup_run(self, mock_ssh):
79 mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
88 plugin_name = plugins.get("name")
89 p._remove_setup(plugin_name, deployment)
90 self.assertIsNotNone(p.client)
94 self.assertEqual(self.result, expected_result)
101 if __name__ == '__main__':