aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/benchmark/scenarios/availability/test_baseattacker.py
diff options
context:
space:
mode:
authorJing Lu <lvjing5@huawei.com>2018-08-27 01:30:46 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-08-27 01:30:46 +0000
commit8af5c098fb0f30cc1bda0dd4431dbce1b2403a16 (patch)
treed4f476bb8712941b230981d18e0cb4ecefe91de3 /yardstick/tests/unit/benchmark/scenarios/availability/test_baseattacker.py
parent3dbd1f37f5250978ada4e7a0766a949985609e6a (diff)
parente3eb9c69d91d4fff2cd0ccf6433fd69162973956 (diff)
Merge "the recovery action of "baremetal down" should be triggered mandatory" into stable/fraser
Diffstat (limited to 'yardstick/tests/unit/benchmark/scenarios/availability/test_baseattacker.py')
-rw-r--r--yardstick/tests/unit/benchmark/scenarios/availability/test_baseattacker.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/yardstick/tests/unit/benchmark/scenarios/availability/test_baseattacker.py b/yardstick/tests/unit/benchmark/scenarios/availability/test_baseattacker.py
new file mode 100644
index 000000000..74f86983b
--- /dev/null
+++ b/yardstick/tests/unit/benchmark/scenarios/availability/test_baseattacker.py
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import unittest
+
+from yardstick.benchmark.scenarios.availability.attacker import baseattacker
+
+
+class BaseAttackerTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.attacker_cfg = {
+ 'fault_type': 'test-attacker',
+ 'action_parameter': {'process_name': 'nova_api'},
+ 'rollback_parameter': {'process_name': 'nova_api'},
+ 'key': 'stop-service',
+ 'attack_key': 'stop-service',
+ 'host': 'node1',
+ }
+ self.base_attacker = baseattacker.BaseAttacker({}, {})
+
+ def test__init__(self):
+ self.assertEqual(self.base_attacker.data, {})
+ self.assertFalse(self.base_attacker.mandatory)
+ self.assertEqual(self.base_attacker.intermediate_variables, {})
+ self.assertFalse(self.base_attacker.mandatory)
+
+ def test_get_attacker_cls(self):
+ with self.assertRaises(RuntimeError):
+ baseattacker.BaseAttacker.get_attacker_cls(self.attacker_cfg)