-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.LoadTest
executable file
·57 lines (55 loc) · 1.6 KB
/
Jenkinsfile.LoadTest
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
pipeline {
agent {
label 'git'
}
parameters {
choice(name: 'namespace', choices: ['staging', 'production'], description: 'where to test')
}
stages {
stage('Health Check') {
steps {
container('curl') {
echo "Execute CURL command to verify UI is up..."
executeCurl(1, "http://front-end.${params.namespace}")
}
}
}
stage('Run e2e load test') {
steps {
// calls script imported into Jenkins from this library
// https://github.com/dynatrace-innovationlab/jenkins-extensions
container('jmeter') {
// need to remove report folder from workspace else jmeter errors
sh "rm -rf e2eCheck"
// remove logs from workspace
sh "rm -f e2eCheck_result.tlf"
sh "rm -f output.txt"
script {
def status = executeJMeter (
scriptName: "jmeter/front-end_e2e_load.jmx",
resultsDir: "e2eCheck",
serverUrl: "front-end.${params.namespace}",
serverPort: 80,
checkPath: '/',
vuCount: 10,
loopCount: 10000,
LTN: "${params.namespace}_loadtest_${env.BUILD_ID}",
funcValidation: false,
avgRtValidation: 4000
)
if (status != 0) {
currentBuild.result = 'FAILED'
error "e2e load test failed."
}
}
}
}
}
}
}
def executeCurl(iterations, url) {
for (int i = 0; i < iterations; i++) {
sh "echo calling ${url}"
sh "curl ${url} -f"
}
}