-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhenc_test.cf
More file actions
280 lines (212 loc) · 7.39 KB
/
Copy pathhenc_test.cf
File metadata and controls
280 lines (212 loc) · 7.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
body common control
{
inputs => {
"module/enc.cf",
"tlib/henc_cfg_test.cf",
} ;
version => "hENC-v0.0.2" ;
bundlesequence => { "henc_cfg", "henc_test" } ;
}
bundle agent henc_test
{
vars:
"tests" int => "8" ;
files:
"$(henc_cfg.testdir)/."
comment => "Prepare test directory",
create => "yes" ;
methods:
"tap_banner" usebundle => henc_tap_banner($(tests)) ;
"basic" usebundle => henc_test_basic ;
"commands" usebundle => henc_test_commands ;
}
bundle agent henc_tap_banner(n) { reports: "$(const.n)1..$(n)" ; }
bundle agent henc_test_basic
{
vars:
any::
"enclist" slist => { "henc_set","henc_override" } ;
classes:
any::
"pass_3_reached" expression => "pass_2_reached" ;
"pass_2_reached" expression => "pass_1_reached" ;
"pass_1_reached" expression => "any" ;
"henc_test_scalar_ok"
expression => regcmp("hENC test","$(henc.test_scalar)") ;
"all_tests_ok"
and => { "global_class_to_be_set_by_henc",
"!global_class_to_be_cancelled_by_henc",
"!global_class_to_be_lowered",
"henc_test_scalar_ok",
"henc_test_list_ok" } ;
pass_2_reached::
# must not evaluate before henc runs...
"henc_test_list_ok"
comment => "list must not be set",
not => isvariable("henc.test_list") ;
files:
!pass_2_reached::
# this must run only at pass 1, to prepare for the tests
"$(henc_cfg.testdir)/$(enclist)" delete => tidy ;
methods:
"henc"
comment => "test ENC",
usebundle => henc("$(this.bundle).enclist") ;
reports:
global_class_to_be_set_by_henc::
"$(const.n)ok - global_class_to_be_set_by_henc found" ;
!global_class_to_be_set_by_henc::
"$(const.n)not ok - global_class_to_be_set_by_henc not found" ;
global_class_to_be_cancelled_by_henc::
"$(const.n)not ok - global_class_to_be_cancelled_by_henc found" ;
!global_class_to_be_cancelled_by_henc::
"$(const.n)ok -1 global_class_to_be_cancelled_by_henc not found" ;
global_class_to_be_lowered::
"$(const.n)not ok - global_class_to_be_lowered found" ;
!global_class_to_be_lowered::
"$(const.n)ok - global_class_to_be_lowered not found" ;
pass_2_reached.henc_test_scalar_ok::
"$(const.n)ok - test scalar has the expected value" ;
pass_2_reached.!henc_test_scalar_ok::
"$(const.n)not ok - test scalar has not the expected value" ;
pass_2_reached.henc_test_list_ok::
"$(const.n)ok - test list was slashed by henc" ;
pass_2_reached.!henc_test_list_ok::
"$(const.n)not ok - test list was not slashed by henc" ;
}
bundle agent henc_test_commands
{
methods:
"test_reset_active" usebundle => henc_test_reset_active ;
"test_reset_cancelled" usebundle => henc_test_reset_cancelled ;
"test_reset_all" usebundle => henc_test_reset_all ;
}
bundle agent henc_test_reset_active
{
vars:
any::
"enclist" slist => { "henc_reset_active" } ;
"active_classes"
slist => { "active_class_1","active_class_2",
"active_class_3" } ;
"cancelled_classes"
slist => { "cancelled_class_1", "cancelled_class_2",
"cancelled_class_3" } ;
"all_classes"
slist => { @(active_classes), @(cancelled_classes) } ;
classes:
any::
"pass_3_reached" expression => "pass_2_reached" ;
"pass_2_reached" expression => "pass_1_reached" ;
"pass_1_reached" expression => "any" ;
!pass_2_reached::
# Set these classes only at pass 1, then let the module kill them
"cancelled_class_1" expression => "any" ;
"cancelled_class_2" expression => "any" ;
"cancelled_class_3" expression => "any" ;
pass_2_reached::
# From pass 2 on, check for the result of the test
"any_class_set" expression => "$(all_classes)" ;
"test_ok" not => "any_class_set" ;
files:
!pass_2_reached::
# this must run only at pass 1, to prepare for the tests
"$(henc_cfg.testdir)/$(enclist)" delete => tidy ;
methods:
"henc"
comment => "test ENC",
usebundle => henc("$(this.bundle).enclist") ;
reports:
pass_2_reached.test_ok::
"$(const.n)ok - active classes correctly reset" ;
pass_2_reached.!test_ok::
"$(const.n)not ok - active classes not reset" ;
}
bundle agent henc_test_reset_cancelled
{
vars:
any::
"enclist" slist => { "henc_reset_cancelled" } ;
"active_classes"
slist => { "active_class_4","active_class_5",
"active_class_6" } ;
"cancelled_classes"
slist => { "cancelled_class_4", "cancelled_class_5",
"cancelled_class_6" } ;
"all_classes"
slist => { @(active_classes), @(cancelled_classes) } ;
"all_classes_set_expr"
string => join(".","all_classes") ;
classes:
any::
"pass_3_reached" expression => "pass_2_reached" ;
"pass_2_reached" expression => "pass_1_reached" ;
"pass_1_reached" expression => "any" ;
!pass_2_reached::
# Set these classes only at pass 1, the module must not kill them
"cancelled_class_4" expression => "any" ;
"cancelled_class_5" expression => "any" ;
"cancelled_class_6" expression => "any" ;
pass_2_reached::
# From pass 2 on, check for the result of the test
# All classes must still be active
"test_ok" expression => "$(all_classes_set_expr)" ;
files:
!pass_2_reached::
# this must run only at pass 1, to prepare for the tests
"$(henc_cfg.testdir)/$(enclist)" delete => tidy ;
methods:
"henc"
comment => "test ENC",
usebundle => henc("$(this.bundle).enclist") ;
reports:
pass_2_reached.test_ok::
"$(const.n)ok - cancelled classes correctly reset" ;
pass_2_reached.!test_ok::
"$(const.n)not ok - cancelled classes not reset" ;
}
bundle agent henc_test_reset_all
{
vars:
any::
"enclist" slist => { "henc_reset_all" } ;
"active_classes"
slist => { "active_class_7","active_class_8",
"active_class_9" } ;
"cancelled_classes"
slist => { "cancelled_class_7", "cancelled_class_8",
"cancelled_class_9" } ;
"any_active_class_set_expr"
string => join('|',"active_classes") ;
"all_cancelled_classes_set_expr"
string => join('.',"cancelled_classes") ;
"test_ok_expr"
string => "!($(any_active_class_set_expr)).($(all_cancelled_classes_set_expr))" ;
classes:
any::
"pass_3_reached" expression => "pass_2_reached" ;
"pass_2_reached" expression => "pass_1_reached" ;
"pass_1_reached" expression => "any" ;
!pass_2_reached::
# Set these classes only at pass 1, the module must not kill them
"cancelled_class_7" expression => "any" ;
"cancelled_class_8" expression => "any" ;
"cancelled_class_9" expression => "any" ;
pass_2_reached::
# From pass 2 on, check for the result of the test
# All classes must still be active
"test_ok" expression => "$(test_ok_expr)" ;
files:
!pass_2_reached::
# this must run only at pass 1, to prepare for the tests
"$(henc_cfg.testdir)/$(enclist)" delete => tidy ;
methods:
"henc"
comment => "test ENC",
usebundle => henc("$(this.bundle).enclist") ;
reports:
pass_2_reached.test_ok::
"$(const.n)ok - all classes in ENC correctly reset" ;
pass_2_reached.!test_ok::
"$(const.n)not ok - all classes in ENC not correctly reset" ;
}