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

View File

@ -40,7 +40,8 @@ class FaultInjectionHookTestCase(test.TestCase):
(dict(), False))
@ddt.unpack
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:
self.assertEqual([], results)
else: