From f0b7c788b02259de1301038d1ce301ea54bb62a3 Mon Sep 17 00:00:00 2001 From: George Vlahavas Date: Mon, 26 Jul 2021 12:13:22 +0300 Subject: [PATCH] Response code should be 200 --- keycloak_test.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keycloak_test.groovy b/keycloak_test.groovy index 39f857d..951a652 100644 --- a/keycloak_test.groovy +++ b/keycloak_test.groovy @@ -38,7 +38,7 @@ pipeline { testName = "KEA_keycloak_success" String token = sh(label: "KEA_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=KEA' | sed 's/.*access_token\":\"//g' | sed 's/\".*//g'", returnStdout: true) 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 != '401' ) { + if ( responseCode != '200' ) { error("$testName: Returned status code = $responseCode when calling $url") } } catch (ignored) { -- 2.2.2