diff --git a/kea_testing.groovy b/kea_testing.groovy index e752366..c777916 100644 --- a/kea_testing.groovy +++ b/kea_testing.groovy @@ -90,12 +90,54 @@ pipeline { /* Here do your tests */ sleep 50 try { - String testName = "1. Check that app is running - 200 response code" + String testName = "KEA_F001" String url = "$APP_URL" String responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) if (responseCode != '200') { error("$testName: Returned status code = $responseCode when calling $url") } + testName = "KEA_F002" + url = "$APP_URL:9091" + responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + testName = "KEA_F003" + url = "$APP_URL:5000" + responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + testName = "KEA_F004" + url = "$APP_URL:1883" + responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + testName = "KEA_F005" + url = "$APP_URL:5432" + responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + testName = "KEA_F006" + url = "$APP_URL:3001" + responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + testName = "KEA_F007" + url = "$APP_URL:5611" + responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } + testName = "KEA_F008" + url = "$APP_URL:9091" + responseCode = sh(label: testName, script: "curl -m 10 -sLI -w '%{http_code}' $url -o /dev/null", returnStdout: true) + if (responseCode != '200') { + error("$testName: Returned status code = $responseCode when calling $url") + } } catch (ignored) { currentBuild.result = 'FAILURE' echo "KEA Deployment Tests failed"