Blame view
kea_testing.groovy
4.75 KB
a7a0d7905 Add initial Jenki... |
1 2 3 4 5 6 7 8 9 10 |
/** * Jenkinsfile to deploy multiple Docker containers based on docker-compose into a DEV server and run any test. * This pipeline will run the Docker containers, execute the tests and then stop and remove the containers from the DEV * server automatically. **/ pipeline { agent any |
097a24e19 Fix whitespace |
11 |
environment { |
fb793d4ad Revert "Revert "A... |
12 |
|
97fe60fba Remove deployment... |
13 14 15 16 17 |
APP_URL = "https://kea.curex-project.eu" KEYCLOAK_URL = "https://keycloak-curex.gnubila.fr/auth/realms/Integration/protocol/openid-connect/token" USER = credentials('keycloak-test-user') PASSWORD = credentials('keycloak-test-password') CLIENT_ID = "KEA" |
a7a0d7905 Add initial Jenki... |
18 19 20 |
} stages { |
a7a0d7905 Add initial Jenki... |
21 |
|
097a24e19 Fix whitespace |
22 |
stage('Run tests') { |
a7a0d7905 Add initial Jenki... |
23 24 |
steps { script { |
f7afd8ea9 Add a simple test |
25 26 27 |
echo '*************' echo '*** TESTS ***' echo '*************' |
a7a0d7905 Add initial Jenki... |
28 |
/* Here do your tests */ |
f7afd8ea9 Add a simple test |
29 |
try { |
97fe60fba Remove deployment... |
30 31 |
// Get Keycloak auth token String token = sh(label: "get_keycloak_token", script: "curl -s -X POST $KEYCLOAK_URL -H 'Content-Type: application/x-www-form-urlencoded' -d 'username=$USER' -d 'password=$PASSWORD' -d 'grant_type=password' -d 'client_id=$CLIENT_ID' | sed 's/.*access_token\":\"//g' | sed 's/\".*//g'", returnStdout: true) |
686bf5b89 Add tests KEA_F00... |
32 |
String testName = "KEA_F001" |
97fe60fba Remove deployment... |
33 34 |
String url = "$APP_URL" String responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) |
f7afd8ea9 Add a simple test |
35 36 37 |
if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } |
97fe60fba Remove deployment... |
38 |
|
55bf5645f Move F004 and F00... |
39 |
testName = "KEA_F002" |
97fe60fba Remove deployment... |
40 41 |
url = "$APP_URL/components/od" responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) |
55bf5645f Move F004 and F00... |
42 43 44 |
if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } |
97fe60fba Remove deployment... |
45 |
|
55bf5645f Move F004 and F00... |
46 |
testName = "KEA_F003" |
97fe60fba Remove deployment... |
47 48 49 50 51 52 53 54 55 |
url = "$APP_URL/components/mltd" responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } testName = "KEA_F004" url = "$APP_URL/api/config" responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) |
55bf5645f Move F004 and F00... |
56 57 58 |
if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } |
97fe60fba Remove deployment... |
59 60 61 62 63 64 65 |
testName = "KEA_F005" url = "$APP_URL/api/capec" responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } |
9396f6c4a Move back grafana... |
66 67 68 |
testName = "KEA_F006" url = "https://kea-grafana.vlahavas.com/api/dashboards/home" responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Αuthorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) |
cfd27a3cb Add back all tests |
69 70 71 |
if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } |
97fe60fba Remove deployment... |
72 |
|
9396f6c4a Move back grafana... |
73 74 |
testName = "KEA_F007" url = "https://kea-kibana.vlahavas.com/app/kibana" |
97fe60fba Remove deployment... |
75 |
responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) |
cfd27a3cb Add back all tests |
76 77 78 |
if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } |
97fe60fba Remove deployment... |
79 |
|
9396f6c4a Move back grafana... |
80 81 |
testName = "KEA_F008" url = "$APP_URL/components/ceptd" |
97fe60fba Remove deployment... |
82 |
responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' -H 'Authorization: Bearer $token' -H 'Accept: application/json, text/plain, */*' $url -o /dev/null", returnStdout: true) |
a440995cf Move KEA_F003 to ... |
83 84 85 |
if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } |
97fe60fba Remove deployment... |
86 |
|
f7afd8ea9 Add a simple test |
87 88 89 90 |
} catch (ignored) { currentBuild.result = 'FAILURE' echo "KEA Deployment Tests failed" } |
a7a0d7905 Add initial Jenki... |
91 92 93 |
} } } |
a7a0d7905 Add initial Jenki... |
94 95 |
} } |
097a24e19 Fix whitespace |
96 |