the recovery action of "baremetal down" should be triggered mandatory
[yardstick.git] / yardstick / tests / unit / benchmark / scenarios / availability / test_baseattacker.py
1 ##############################################################################
2 # Copyright (c) 2018 Huawei Technologies Co.,Ltd and others.
3 #
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 ##############################################################################
9
10 import unittest
11
12 from yardstick.benchmark.scenarios.availability.attacker import baseattacker
13
14
15 class BaseAttackerTestCase(unittest.TestCase):
16
17     def setUp(self):
18         self.attacker_cfg = {
19             'fault_type': 'test-attacker',
20             'action_parameter': {'process_name': 'nova_api'},
21             'rollback_parameter': {'process_name': 'nova_api'},
22             'key': 'stop-service',
23             'attack_key': 'stop-service',
24             'host': 'node1',
25         }
26         self.base_attacker = baseattacker.BaseAttacker({}, {})
27
28     def test__init__(self):
29         self.assertEqual(self.base_attacker.data, {})
30         self.assertFalse(self.base_attacker.mandatory)
31         self.assertEqual(self.base_attacker.intermediate_variables, {})
32         self.assertFalse(self.base_attacker.mandatory)
33
34     def test_get_attacker_cls(self):
35         with self.assertRaises(RuntimeError):
36             baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)