diff --git a/k6/crds/create_crds.js b/k6/crds/create_crds.js index 43aea3f..be33653 100644 --- a/k6/crds/create_crds.js +++ b/k6/crds/create_crds.js @@ -55,7 +55,7 @@ function cleanup(cookies, namePrefix) { // Test functions, in order of execution export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`) } const cookies = getCookies(baseUrl) diff --git a/k6/crds/delete_crds.js b/k6/crds/delete_crds.js index ae70060..fcb5dd8 100644 --- a/k6/crds/delete_crds.js +++ b/k6/crds/delete_crds.js @@ -56,7 +56,7 @@ function cleanup(cookies) { // Test functions, in order of execution export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`) } const cookies = getCookies(baseUrl) diff --git a/k6/crds/get_crds.js b/k6/crds/get_crds.js index adfca4a..2562531 100644 --- a/k6/crds/get_crds.js +++ b/k6/crds/get_crds.js @@ -40,7 +40,7 @@ export const options = { export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`) } const cookies = getCookies(baseUrl) diff --git a/k6/crds/load_crds.js b/k6/crds/load_crds.js index a7cb7a1..2b34a99 100644 --- a/k6/crds/load_crds.js +++ b/k6/crds/load_crds.js @@ -86,7 +86,7 @@ function cleanup(cookies) { // Test functions, in order of execution export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`); } const cookies = getCookies(baseUrl); diff --git a/k6/crds/update_crds.js b/k6/crds/update_crds.js index 53458a1..1a6c7dd 100644 --- a/k6/crds/update_crds.js +++ b/k6/crds/update_crds.js @@ -87,7 +87,7 @@ function cleanup(cookies) { // Test functions, in order of execution export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`) } const cookies = getCookies(baseUrl) diff --git a/k6/crds/update_destructive_crds.js b/k6/crds/update_destructive_crds.js index 6d31b35..4f39f8b 100644 --- a/k6/crds/update_destructive_crds.js +++ b/k6/crds/update_destructive_crds.js @@ -90,7 +90,7 @@ function cleanup(cookies) { // Test functions, in order of execution export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`) } const cookies = getCookies(baseUrl) diff --git a/k6/rancher/rancher_utils.js b/k6/rancher/rancher_utils.js index 25f348b..2f47670 100644 --- a/k6/rancher/rancher_utils.js +++ b/k6/rancher/rancher_utils.js @@ -1,6 +1,6 @@ import { check, fail, sleep } from 'k6' import http from 'k6/http' -import { getUserId, getUserPreferences, setUserPreferences } from "./rancher_users_utils.js" +import { getCurrentUserId, getUserPreferences, setUserPreferences } from "./rancher_users_utils.js" import encoding from 'k6/encoding'; @@ -27,13 +27,13 @@ export function login(baseUrl, cookies, username, password) { 'login works': (r) => r.status === 200 || r.status === 401, }) - return response.status === 200 + return response } export function firstLogin(baseUrl, cookies, bootstrapPassword, password) { let response - if (login(baseUrl, cookies, "admin", bootstrapPassword)) { + if (login(baseUrl, cookies, "admin", bootstrapPassword).status === 200) { response = http.post( `${baseUrl}/v3/users?action=changepassword`, JSON.stringify({ "currentPassword": bootstrapPassword, "newPassword": password }), @@ -54,11 +54,11 @@ export function firstLogin(baseUrl, cookies, bootstrapPassword, password) { } else { console.warn("bootstrap password already changed") - if (!login(baseUrl, cookies, "admin", password)) { + if (login(baseUrl, cookies, "admin", password).status !== 200) { fail('neither bootstrap nor normal passwords were accepted') } } - const userId = getUserId(baseUrl, cookies) + const userId = getCurrentUserId(baseUrl, cookies) const userPreferences = getUserPreferences(baseUrl, cookies); userPreferences["data"]["locale"] = "en-us" @@ -195,7 +195,7 @@ export function addMinutes(date, minutes) { export function createImportedCluster(baseUrl, cookies, name) { let response - const userId = getUserId(baseUrl, cookies) + const userId = getCurrentUserId(baseUrl, cookies) const userPreferences = getUserPreferences(baseUrl, cookies); userPreferences["last-visited"] = "{\"name\":\"c-cluster-product\",\"params\":{\"cluster\":\"_\",\"product\":\"manager\"}}" diff --git a/k6/schemas/verify_schema_definitions.js b/k6/schemas/verify_schema_definitions.js index 6f1a51f..fe92639 100644 --- a/k6/schemas/verify_schema_definitions.js +++ b/k6/schemas/verify_schema_definitions.js @@ -91,7 +91,7 @@ function cleanup(cookies) { // Test functions, in order of execution export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`) } const cookies = getCookies(baseUrl) diff --git a/k6/schemas/verify_schemas.js b/k6/schemas/verify_schemas.js index 5381097..04a348a 100644 --- a/k6/schemas/verify_schemas.js +++ b/k6/schemas/verify_schemas.js @@ -89,7 +89,7 @@ function cleanup(cookies) { // Test functions, in order of execution export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`) } const cookies = getCookies(baseUrl) diff --git a/k6/tests/tokens.js b/k6/tests/tokens.js index d45b11a..6e760db 100644 --- a/k6/tests/tokens.js +++ b/k6/tests/tokens.js @@ -43,7 +43,7 @@ export const options = { export function setup() { // log in - if (!login(baseUrl, {}, username, password)) { + if (login(baseUrl, {}, username, password).status !== 200) { fail(`could not login into cluster`) } const cookies = getCookies(baseUrl)