-
Notifications
You must be signed in to change notification settings - Fork 20
/
tester.yml
379 lines (360 loc) · 13.4 KB
/
tester.yml
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
#For proper functionality ports 8888 and 8899 should be opened.
#Opening 6655 should simplify a lerning curve, and what is happening with fileSystem locally.
#These constants should be controlled from the environment
_constants:
parameters:
# For advanced usage, almost as constants
- atdd-path:
description: Path to atdd report
default: /home/ubuntu/report/atdd
- dashboard-path:
description: Path to dashboard
default: /home/ubuntu/report/dashboard
# These parameters must be defined in environment to let s3 work
- access-key:
description: "access key / identity"
- secret-key:
description: "secret key / credentials"
steps: []
return:
- atdd-path:
value: ${atdd-path}
- dashboard-path:
value: ${dashboard-path}
- access-key:
value: ${access-key}
- secret-key:
value: ${secret-key}
launch:
parameters:
- base-url: &base-url
description: Application base Url
- grid-remote:
description: Selenium Grid
default: x.x.x.x:4444
- app-fork: &app-fork
description: Source control fork
default: "dieu"
- app-branch: &app-branch
description: Source control branch
default: "HEAD"
- flavour: &flavour
description: ami-flavour
default: ubuntu
steps:
- inject-constants: &inject-constants
action: _constants
phase: injection
output:
atdd-path: atdd-path
dashboard-path: dashboard-path
access-key: access-key
secret-key: secret-key
- tester-provision:
action: provisionVms
phase: provision
parameters:
roleName: tester
hardwareId: m1.small
vmIdentity: ubuntu
imageId: us-east-1/ami-0fac7566
output:
tester-host: ips
- install-java:
action: chefrun
phase: install-java
precedingPhases: [ provision ]
parameters:
roles: [ tester ]
isSolo: true
runList: ["recipe[java]" ]
recipeUrl: "https://s3.amazonaws.com/adp-chef/cookbooks-v0.0.4.tar.gz"
- git-clone: &git-clone
action: .gitClone
phase: git-clone
precedingPhases: [ install-java ]
parameters:
url: "https://github.com/${app-fork}/petclinic.git"
branch: "${app-branch}"
targetDirectory: "/tmp/petclinic"
- get-maven:
action: chefrun
phase: get-maven
precedingPhases: [ install-java ]
parameters:
roles: [ tester ]
isSolo: true
runList: ["recipe[maven]"]
recipeUrl: "https://s3.amazonaws.com/adp-chef/petclinic_cookbooks-v2.tar.gz"
jattrs:
maven:
version: 3
setup_bin: true
"3":
url: "http://apache.mirrors.tds.net/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz"
- prepare-test-storage:
action: .prepare_s3cmd
phase: init-test-storage
precedingPhases: [ git-clone, get-maven ]
- software-prepare-complete:
action: wait
phase: prepared
precedingPhases: [ injection, install-java, get-maven, git-clone, init-test-storage ]
- test: &test
action: execrun
phase: testing
precedingPhases: [ prepared ]
parameters:
roles: [ tester ]
command:
- bash
- "-c"
-
!
cd /tmp/petclinic/; rm -rf ${atdd-path}; mvn -f itpom.xml clean integration-test thucydides:aggregate -Dwebdriver.base.url=${base-url} -Dthucydides.outputDirectory=${atdd-path} -Dthucydides.sourceDirectory=${atdd-path} -Dwebdriver.remote.url=http://${grid-remote}/wd/hub -Dmaven.test.failure.ignore=true; true
- aggregate-report: &aggregate-report
action: .generateReport
phase: reporting
precedingPhases: [ testing ]
parameters:
app-version: "{$.flavour}"
output:
test-progress: progress
test-history: history
test-run-id: run-id
- http-total:
action: execrun
phase: share
precedingPhases: [ provision ]
parameters:
roles: [ tester ]
command:
- "bash -c 'cd / ; python -m SimpleHTTPServer 6655 &'"
- http-report:
action: execrun
phase: share2
precedingPhases: [ reporting ]
parameters:
roles: [ tester ]
command:
- "bash -c 'cd ${atdd-path} ; python -m SimpleHTTPServer 8888 &'"
- http-dashboard:
action: execrun
phase: share3
precedingPhases: [ reporting ]
parameters:
roles: [ tester ]
command:
- "bash -c 'cd ${dashboard-path} ; python -m SimpleHTTPServer 8899 &'"
return:
manage.tester-ip:
description: "Tester's ip"
value: "{$.tester-host[0]}"
manage.navigate:
description: "File system over web"
value: "http://{$.tester-host[0]}:6655"
manage.application:
description: "Application under test url"
value: ${base-url}
dashboard.attd-report:
description: "Attd report"
value: "http://{$.tester-host[0]}:8888"
dashboard.reports:
description: "Dashboard"
value: "http://{$.tester-host[0]}:8899"
dashboard.selenium-console:
description: "Selenium Console"
value: "http://${grid-remote}/grid/beta/console"
test.progress: &return-progress
description: "Latest Test Summary"
value: ${test-progress}
test.history: &return-history
description: "Test History"
value: ${test-history}
test.run-id: &return-run-id
description: "Latest Run Id"
value: ${test-run-id}
retest:
parameters:
- base-url: *base-url
- app-fork: *app-fork
- app-branch: *app-branch
- flavour: *flavour
steps:
- inject-constants: *inject-constants
- git-clone: *git-clone
- git-reclone-complete:
action: wait
phase: prepared
precedingPhases: [ injection, git-clone ]
- test: *test
- aggregate-report: *aggregate-report
return:
test.progress: *return-progress
test.history: *return-history
test.run-id: *return-run-id
#macroses
.gitClone:
parameters:
- url:
description: git url
- targetDirectory:
description: where to clone
- branch:
description: Source control branch
steps:
- install-git:
action: execrun
description: Install git on new machine
phase: "install-git"
parameters:
roles: [ tester ]
isSudo: true
command:
- "which git || (which yum && sudo yum -y install git-core || sudo apt-get -y --force-yes install git-core) || true"
- clone-repo:
action: execrun
description: Sample command for cloning git repos
phase: "clone"
precedingPhases: ["install-git"]
parameters:
roles: [ tester ]
command:
# this is the quikest I can do, is remove and clone other branch, but the right way are remotes.
- "rm -rf ${targetDirectory}; git clone ${url} -b ${branch} ${targetDirectory}"
.generateReport:
parameters:
- app-version:
description: Build Id
default: latest
steps:
- inject-constants: *inject-constants
- report-gen:
action: execrun
description: Generate detailed report
phase: "generate-report"
precedingPhases: [ injection ]
parameters:
roles: [ tester ]
command:
- bash
- "-c"
-
!
mkdir -p ${dashboard-path} && cp /tmp/petclinic/report/*.* ${dashboard-path};
cd ${dashboard-path};
./collect.sh /tmp/petclinic//target/failsafe-reports/ ${app-version}__${app-fork}__${app-branch}
- install-xsltproc:
action: execrun
phase: "prepare-xsltoroc"
precedingPhases: ["generate-report"]
parameters:
roles: [ tester ]
isSudo: true
command:
- "which xsltproc || (which yum && sudo yum -y install xsltproc || sudo apt-get -y --force-yes install xsltproc) || true"
- progress-gen:
action: execrun
phase: "generate-progress"
precedingPhases: ["prepare-xsltoroc"]
parameters:
roles: [ tester ]
command:
- bash
- "-c"
-
!
cd ${dashboard-path};
xsltproc progress.xsl ${app-version}__${app-fork}__${app-branch}.xml
output:
progress_raw: stdout
- progress-log:
action: execrun
phase: "generate-progress"
precedingPhases: ["prepare-xsltoroc"]
parameters:
roles: [ tester ]
command:
- "find ${dashboard-path}/ -name '*.xml' -print0 | xargs -0 -I %% bash -c 'echo \"file: %% | $$(xsltproc ${dashboard-path}/progress.xsl %%)\"'"
output:
progress_log: stdout
- upload-to-test-storage:
action: .upload
precedingPhases: ["generate-report"]
parameters:
app-version: ${app-version}
return:
progress:
description: "Test summary"
value: "{$.aggregate-report~progress_raw['*'][-1:]}" #I don't like this syntax
history:
description: "History"
value: ${progress_log} #todo flatten map (remove ip)
run-id:
description: "Test Run identifier"
value: ${app-version}__${app-fork}__${app-branch}
.prepare_s3cmd:
steps:
- inject-constants: *inject-constants
- install-s3cmd:
action: execrun
phase: "install-s3cmd"
precedingPhases: ["provision"]
parameters:
roles: [ tester ]
isSudo: true
command:
- "which s3cmd || (which yum && sudo yum -y install s3cmd || sudo apt-get -y --force-yes install s3cmd) || true"
- configure-s3cmd:
action: execrun
phase: "config-s3cmd"
precedingPhases: [ injection, "install-s3cmd"]
parameters:
roles: [ tester ]
command:
-
!
wget https://s3.amazonaws.com/adp-chef/s3cmd.conf.sh;
chmod +x s3cmd.conf.sh;
AWS_ACCESS_KEY_ID=${access-key} AWS_SECRET_ACCESS_KEY=${secret-key} ./s3cmd.conf.sh >~/.s3cfg
#On your s3 account petclinic-test-results bucket should exist
.upload:
parameters:
- app-version:
description: Build Id
steps:
- inject-constants: *inject-constants
- upload-results:
action: execrun
precedingPhases: [ injection ]
parameters:
roles: [ tester ]
command:
- bash
- "-c"
-
!
export RESULT_STAMP=${app-fork}_${app-branch}_${app-version}_$$(date -u +%Y%m%d%H%M%S);
rm -rf /tmp/uploads;
mkdir -p /tmp/uploads/$$RESULT_STAMP;
cp ${dashboard-path}/${app-version}__${app-fork}__${app-branch}.xml /tmp/uploads/$$RESULT_STAMP/${app-version}__${app-fork}__${app-branch}.xml;
s3cmd sync /tmp/uploads/$$RESULT_STAMP s3://petclinic-test-results/;
s3cmd sync ${atdd-path} s3://petclinic-test-results/$$RESULT_STAMP/
manual-control:
parameters:
- run-command:
description: command to execute
default: "bash -c 'echo define this'"
steps:
- custom-exec:
action: execrun
phase: testing
precedingPhases: [ prepared ]
parameters:
roles: [ tester ]
command:
- "${run-command}"
destroy:
steps:
- destroy:
action: compute.shrink-all