mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Add another working prereq simple test
This commit is contained in:
parent
0354e408e3
commit
8177f2b609
@ -0,0 +1,57 @@
|
||||
#
|
||||
# Theory:
|
||||
#
|
||||
# C <--+ <--+ <-+ <-+
|
||||
# | | | |
|
||||
# A ---+ | | | # order of A/B/D/E is free
|
||||
# | | |
|
||||
# B --------+ | |
|
||||
# | |
|
||||
# D-------------+ |
|
||||
# |
|
||||
# E-----------------+
|
||||
|
||||
# B --------+----->(ouch, unrespected C prereq B)
|
||||
# |
|
||||
# C <--+ <--+ <-+ <-+
|
||||
# | | |
|
||||
# D ---+ | |
|
||||
# | |
|
||||
# E-------------+ |
|
||||
# |
|
||||
# A-----------------+
|
||||
|
||||
# runs after C
|
||||
A:
|
||||
cmd.run:
|
||||
- name: echo A
|
||||
# is running in test mode before C
|
||||
# C gets executed first if this states modify something
|
||||
- prereq_in:
|
||||
- cmd: C
|
||||
|
||||
B:
|
||||
cmd.run:
|
||||
- name: echo B
|
||||
|
||||
# runs before D and B
|
||||
C:
|
||||
cmd.run:
|
||||
- name: echo C
|
||||
# will test D and be applied only if D changes,
|
||||
# and then will run before D. Same for B
|
||||
- prereq:
|
||||
- cmd: B
|
||||
- cmd: D
|
||||
|
||||
D:
|
||||
cmd.run:
|
||||
- name: echo D
|
||||
|
||||
E:
|
||||
cmd.run:
|
||||
- name: echo E
|
||||
# is running in test mode before C
|
||||
# C gets executed first if this states modify something
|
||||
- prereq_in:
|
||||
- cmd: C
|
@ -587,6 +587,28 @@ fi
|
||||
+ ' foobar: A\n',
|
||||
'result': False}
|
||||
}
|
||||
expected_result_simple2={
|
||||
'cmd_|-A_|-echo A_|-run': {
|
||||
'__run_num__': 1,
|
||||
'comment': 'Command "echo A" run',
|
||||
'result': True},
|
||||
'cmd_|-B_|-echo B_|-run': {
|
||||
'__run_num__': 2,
|
||||
'comment': 'Command "echo B" run',
|
||||
'result': True},
|
||||
'cmd_|-C_|-echo C_|-run': {
|
||||
'__run_num__': 0,
|
||||
'comment': 'Command "echo C" run',
|
||||
'result': True},
|
||||
'cmd_|-D_|-echo D_|-run': {
|
||||
'__run_num__': 3,
|
||||
'comment': 'Command "echo D" run',
|
||||
'result': True},
|
||||
'cmd_|-E_|-echo E_|-run': {
|
||||
'__run_num__': 4,
|
||||
'comment': 'Command "echo E" run',
|
||||
'result': True}
|
||||
}
|
||||
expected_result_complex={
|
||||
'cmd_|-A_|-echo A fourth_|-run': {
|
||||
'__run_num__': 3,
|
||||
@ -615,6 +637,16 @@ fi
|
||||
}
|
||||
self.assertEqual(expected_result_simple, result)
|
||||
|
||||
result={}
|
||||
ret = self.run_function('state.sls', mods='requisites.prereq_simple2')
|
||||
for item,descr in ret.iteritems():
|
||||
result[item] = {
|
||||
'__run_num__': descr['__run_num__'],
|
||||
'comment':descr['comment'],
|
||||
'result':descr['result']
|
||||
}
|
||||
self.assertEqual(expected_result_simple2, result)
|
||||
|
||||
ret = self.run_function('state.sls', mods='requisites.prereq_compile_error1')
|
||||
self.assertEqual(
|
||||
ret['cmd_|-B_|-echo B_|-run']['comment'],
|
||||
|
Loading…
Reference in New Issue
Block a user