Commit f7afd8ea957502a51ce32040a4d5b4e80baa458f
1 parent
d638fea7e9
Exists in
master
and in
4 other branches
Add a simple test
Showing 1 changed file with 15 additions and 3 deletions
kea_testing.groovy
View file @
f7afd8e
... | ... | @@ -46,10 +46,22 @@ |
46 | 46 | stage('Run tests') { |
47 | 47 | steps { |
48 | 48 | script { |
49 | - | |
50 | - echo 'Run any necessary test' | |
49 | + echo '*************' | |
50 | + echo '*** TESTS ***' | |
51 | + echo '*************' | |
51 | 52 | /* Here do your tests */ |
52 | - | |
53 | + sleep 50 | |
54 | + try { | |
55 | + String testName = "1. Check that app is running - 200 response code" | |
56 | + String url = "http://kea.curex-project.eu/" | |
57 | + String responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) | |
58 | + if (responseCode != '200') { | |
59 | + error("$testName: Returned status code = $responseCode when calling $url") | |
60 | + } | |
61 | + } catch (ignored) { | |
62 | + currentBuild.result = 'FAILURE' | |
63 | + echo "KEA Deployment Tests failed" | |
64 | + } | |
53 | 65 | } |
54 | 66 | } |
55 | 67 | } |