Skip to content
Snippets Groups Projects
Commit 5b3d4cc3 authored by Malte Finsterwalder's avatar Malte Finsterwalder
Browse files

HOLI-6590 fix extract ory login

parent bad14319
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ module.exports = { ...@@ -12,7 +12,7 @@ module.exports = {
ecmaVersion: '6', ecmaVersion: '6',
sourceType: 'module', sourceType: 'module',
}, },
plugins: ['prettier'], plugins: ['@typescript-eslint', 'prettier'],
rules: { rules: {
'prettier/prettier': ['error'], 'prettier/prettier': ['error'],
'linebreak-style': ['error', 'unix'], 'linebreak-style': ['error', 'unix'],
......
...@@ -30,11 +30,7 @@ export const checkFailureRate = new Rate('check_failure_rate') ...@@ -30,11 +30,7 @@ export const checkFailureRate = new Rate('check_failure_rate')
export const timeToFirstByte = new Trend('time_to_first_byte', true) export const timeToFirstByte = new Trend('time_to_first_byte', true)
export function setup() { export function setup() {
//console.log(JSON.parse(resLogin.body).session.identity) return loginOryGetAuthHeaders()
return {
graphQLAuthenticatedUserHeaders: loginOryGetAuthHeaders(),
//userId: JSON.parse(resLogin.body).session.identity.id,
}
} }
export default function (data) { export default function (data) {
......
...@@ -39,10 +39,7 @@ export function setup() { ...@@ -39,10 +39,7 @@ export function setup() {
if (!(testToRun in tests)) { if (!(testToRun in tests)) {
throw `don't know test ${testToRun}, choose one of ${Object.keys(tests)}` throw `don't know test ${testToRun}, choose one of ${Object.keys(tests)}`
} }
return { return loginOryGetAuthHeaders()
graphQLAuthenticatedUserHeaders: loginOryGetAuthHeaders(),
userId: JSON.parse(resLogin.body).session.identity.id,
}
} }
export function handleSummary(data) { export function handleSummary(data) {
......
import http from 'k6/http' import http from 'k6/http'
import { check } from 'k6' import { check } from 'k6'
import { graphQLHeaders, graphQLApiUrl, oryLoginUrl } from './const.js' import { graphQLHeaders, graphQLApiUrl, oryLoginUrl, oryUserIdentifier, oryUserPassword } from './const.js'
import { checkFailureRate, timeToFirstByte } from './main.js' import { checkFailureRate, timeToFirstByte } from './main.js'
export function loginOryGetAuthHeaders() { export function loginOryGetAuthHeaders() {
...@@ -14,8 +14,13 @@ export function loginOryGetAuthHeaders() { ...@@ -14,8 +14,13 @@ export function loginOryGetAuthHeaders() {
identifier: oryUserIdentifier, identifier: oryUserIdentifier,
password: oryUserPassword, password: oryUserPassword,
method: 'password', method: 'password',
}) }).body
return getGraphQLAuthenticatedUserHeaders(JSON.parse(resLogin.body).session_token) const resLoginBody = JSON.parse(resLogin.body)
//console.log(JSON.parse(resLogin.body).session.identity)
return {
graphQLAuthenticatedUserHeaders: getGraphQLAuthenticatedUserHeaders(resLoginBody.session_token),
userId: resLoginBody.session?.identity?.id,
}
} }
export function addBatchRequest(query, variables, tags, headers) { export function addBatchRequest(query, variables, tags, headers) {
......
yarn.lock 0 → 100644
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment