1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 # yardstick.benchmark.scenarios.availability.attacker.attacker_process
13 from __future__ import absolute_import
17 from yardstick.benchmark.scenarios.availability.attacker import baseattacker
21 'yardstick.benchmark.scenarios.availability.attacker.attacker_process.ssh')
22 class AttackerServiceTestCase(unittest.TestCase):
28 "key_filename": "/root/.ssh/id_rsa"
30 self.context = {"node1": host}
32 'fault_type': 'kill-process',
33 'process_name': 'nova-api',
37 def test__attacker_service_all_successful(self, mock_ssh):
39 cls = baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)
40 ins = cls(self.attacker_cfg, self.context)
42 mock_ssh.SSH.from_node().execute.return_value = (0, "10", '')
47 def test__attacker_service_check_failuer(self, mock_ssh):
49 cls = baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)
50 ins = cls(self.attacker_cfg, self.context)
52 mock_ssh.SSH.from_node().execute.return_value = (0, None, '')