Port hooks to the new format

Originally, we did not find a good terms for hook entities, so term "hook"
had several meanings: the plugin of action and the combination of
trigger+action configs.

While we are working on task format v2, we can make the things easier.

* rename plugin base Hook to HookAction;
* unification section "hooks" of task config format v2. Now, it
  looks similar to other sections.

Change-Id: Ic800fd4c9cb1ca19b7f6896e2994ca2e30f5138a
This commit is contained in:
Andrey Kurilin
2017-09-12 15:44:34 +03:00
committed by Boris Pavlovic
parent af9865c447
commit cb653e5e23
2 changed files with 26 additions and 31 deletions

View File

@@ -253,28 +253,25 @@
times: 20 times: 20
concurrency: 2 concurrency: 2
hooks: hooks:
- name: sys_call - description: Run script
description: Run script action:
args: sh rally-jobs/extra/hook_example_script.sh sys_call: sh rally-jobs/extra/hook_example_script.sh
trigger: trigger:
name: event event:
args:
unit: iteration unit: iteration
at: [2, 5, 8, 13, 17] at: [2, 5, 8, 13, 17]
- name: sys_call - description: Show time
description: Show time action:
args: date +%Y-%m-%dT%H:%M:%S sys_call: date +%Y-%m-%dT%H:%M:%S
trigger: trigger:
name: event event:
args:
unit: time unit: time
at: [0, 2, 5, 6, 9] at: [0, 2, 5, 6, 9]
- name: sys_call - description: Show system name
description: Show system name action:
args: uname -a sys_call: uname -a
trigger: trigger:
name: event event:
args:
unit: iteration unit: iteration
at: [2, 3, 4, 5, 6, 8, 10, 12, 13, 15, 17, 18] at: [2, 3, 4, 5, 6, 8, 10, 12, 13, 15, 17, 18]
sla: sla:
@@ -290,12 +287,11 @@
times: 10 times: 10
concurrency: 2 concurrency: 2
hooks: hooks:
- name: sys_call - description: test hook
description: test hook action:
args: /bin/true sys_call: /bin/true
trigger: trigger:
name: periodic periodic:
args:
unit: iteration unit: iteration
step: 2 step: 2
start: 4 start: 4
@@ -312,12 +308,11 @@
serial: serial:
times: 10 times: 10
hooks: hooks:
- name: sys_call - description: Show system name
description: Get system name action:
args: uname -a sys_call: uname -a
trigger: trigger:
name: event event:
args:
unit: time unit: time
at: [0, 2, 4, 6, 8, 10] at: [0, 2, 4, 6, 8, 10]
sla: sla:
@@ -332,12 +327,11 @@
serial: serial:
times: 10 times: 10
hooks: hooks:
- name: sys_call - description: test hook
description: test hook action:
args: /bin/true sys_call: /bin/true
trigger: trigger:
name: periodic periodic:
args:
unit: time unit: time
step: 2 step: 2
start: 0 start: 0

View File

@@ -40,7 +40,8 @@ class FaultInjectionHookTestCase(test.TestCase):
(dict(), False)) (dict(), False))
@ddt.unpack @ddt.unpack
def test_config_schema(self, config, valid): def test_config_schema(self, config, valid):
results = hook.Hook.validate("fault_injection", None, None, config) results = hook.HookAction.validate("fault_injection", None, None,
config)
if valid: if valid:
self.assertEqual([], results) self.assertEqual([], results)
else: else: