From bb0997d79c260d404298981991c5e58a921a296c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Colombaro?= Date: Sat, 23 Nov 2024 21:03:38 +0000 Subject: [PATCH] Fix k6 API use --- lib/abstract-test.js | 2 +- lib/benchmark.js | 2 +- lib/caching.js | 2 +- lib/concatenation.js | 2 +- lib/ssl.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/abstract-test.js b/lib/abstract-test.js index 0d00ff5..4ae8b7a 100644 --- a/lib/abstract-test.js +++ b/lib/abstract-test.js @@ -1,5 +1,5 @@ import { check, fail, group } from 'k6' -import * as http from 'k6/http' +import http from 'k6/http' export const options = { thresholds: { diff --git a/lib/benchmark.js b/lib/benchmark.js index fd412cb..8a077f6 100644 --- a/lib/benchmark.js +++ b/lib/benchmark.js @@ -1,5 +1,5 @@ import { check } from 'k6' -import * as http from 'k6/http' +import http from 'k6/http' export const options = { stages: [ diff --git a/lib/caching.js b/lib/caching.js index f01fe08..44924ca 100644 --- a/lib/caching.js +++ b/lib/caching.js @@ -1,5 +1,5 @@ import { options, prepare, test } from './abstract-test.js' -import * as http from 'k6/http' +import http from 'k6/http' export { options } diff --git a/lib/concatenation.js b/lib/concatenation.js index 0d8ae14..c7496f0 100644 --- a/lib/concatenation.js +++ b/lib/concatenation.js @@ -23,6 +23,6 @@ export function setup () { export default function (data) { assert(data, 'http://server.localhost/', (test) => ({ 'is expected status': (r) => isEqual(r, 'Status', r.status, 200), - 'is expected body': (r) => isEqual(r, 'body', r.body.trim(), test.responseBody.trim()) + 'is expected body': (r) => isEqual(r, 'body', r.body?.trim(), test.responseBody?.trim()) })) } diff --git a/lib/ssl.js b/lib/ssl.js index 659a921..b78186e 100644 --- a/lib/ssl.js +++ b/lib/ssl.js @@ -1,4 +1,4 @@ -import * as http from 'k6/http' +import http from 'k6/http' import { options as defaultOptions, prepare, assert } from './abstract-test.js' export const options = Object.assign(defaultOptions, {