Questions tagged [k6]
k6 is a backend infrastructure load testing tool written in Go which runs load tests written in JavaScript.
324
questions
-1
votes
0
answers
19
views
k6 response time differences between automatic and manual run of pipeline
So, the big problem is that I created a pipeline in azure devops, with k6, for our baseline which runs daily. Everyday the pipeline starts automatically at 7AM, and i noticed that the response times ...
0
votes
1
answer
10
views
xk6-sql extension: db connection cannot be passed from setup() stage
I had a test case where there were 2 scenarios to insert data to MySQL tables via xk6-sql extension. Here is the structure of my code.
main.js
import sql from "k6/x/sql";
export { runtest1 } ...
0
votes
0
answers
32
views
Autocomplete not working in visual studio code
I am started to study K6, and used the k6-kafka extension to make a stress test with Kafka.
So I generated the new version from this repo https://github.com/mostafa/xk6-kafka.
And the autocomplete not ...
0
votes
1
answer
23
views
How to increase the limit of open connections on mac
I need to trigger 30K+ requests from MacBook. How can I increase the limit to trigger that much of requests without any interruption? is there any way to way to increase the limits? if 30k is not ...
0
votes
1
answer
51
views
xk6 failed to build if "xk6-output-prometheus-remote" extension is added with another one
I am trying to build a k6 binary using xk6 to add the extensions that I need. First of all, I downloaded the latest version of xk6:
go install go.k6.io/xk6/cmd/xk6@latest
After that, I have the xk6 ...
0
votes
0
answers
29
views
K6 auth0 (429 errors)
I recently use K6 for ouu API load testing, but unfortunately I'm blocked with auth0 (429 error ), I need to know if it's possible to set a session feature like pytest ? obtain an access token one ...
0
votes
1
answer
28
views
How to make plain text http2(h2c) load test using grafana k6
I know k6 is able to promote to http2 if the server is supported. But there seems no means to generate h2c traffic which is used far and wide in internal network element communication. Anyone know how ...
0
votes
1
answer
45
views
Sending traces when running load tests with Grafana k6
I want to see traces of all http requests which are send during a loadtest with k6. I used k6/experimental/tracing and tried the example from the documentation. However, it only adds the tracing ...
0
votes
1
answer
22
views
k6 redis client doesn't connect to Azure Cache for Redis
When I setup the k6 redis client to connect to an azure Redis instance in the cloud, I get this error:
ERRO[0001] Uncaught (in promise) i/o timeout
Here is the client setup code:
const redisClient = ...
0
votes
1
answer
61
views
K6 could not initialize '*path*' SyntaxError: Compiler bug: Lexical declaration for an unbound name at webpack
Trying to run K6 test using web-pack
Using k6-template-typescript
Have also installed winston logger and axios (k6 don't like thous two dependencies for some reason)
Web-pack response
> typescript@...
0
votes
0
answers
55
views
Unable to transpile typescript to es5 when using AWS SDK
I'm running k6, which is a load testing tool built in Go that loads Javascript into a JS VM for execution. As such, I have some webpack and babel config that allows me to first transpile to es5 then ...
0
votes
0
answers
118
views
k6 - can't import function from another file - moduleSpecifier couldn't be found on local disk
Here is a test file where I import a function from another file
tests/signup.ts
import http from 'k6/http';
import { sleep, check } from 'k6';
import { getCloudflareToken } from '../GoogleCloud';
...
-1
votes
1
answer
102
views
Update variable to every VU on K6 (refresh token)
At the beginning of my K6 test, I use my setup() function to ask for a token with the objective of use it on every VU. I don't want each VU using its own token, I want the same for every VU.
That's OK,...
0
votes
1
answer
46
views
How to send a log message to Datadog Vector from k6
We have some Datadog Vector applications with vector datasources.
We would like to run some performance tests using k6 for breakpoint and load tests.
However there there is not existing plugin in k6 ...
0
votes
1
answer
77
views
k6.io read binary file with TextDecoder file due to issue with util package
I'm using k6.io tests and would like to import TextDecoder (from util package)
In my script, I would like to read the binary file:
import { sleep, check } from 'k6';
import { Options } from 'k6/...
0
votes
1
answer
77
views
How to visualize endpoint test results individually when load testing with k6, influxDB, and Grafana?
I currently have a working version of a load testing environment, using k6, influxDB, and Grafana. Right now, it records requests to a number of endpoints and sends the output to a Grafana dashboard, ...
0
votes
0
answers
99
views
Typescript fs.writeFileSync failed wit Value is not an object
Would you please help to understand what is wrong with my entry parameters to fs.writeFileSync which causes ERRO - 'Value is not an object'
k6 script:
import { sleep, check } from 'k6';
import { ...
0
votes
0
answers
49
views
Display K6 data as Locust does
We're currently using Locust and we want to switch into k6 (and implement docker).
The docker implementation is working, k6 command works as expected.
I've found the k6-reporter repository to render ...
0
votes
1
answer
116
views
xk6 Prometheus remote write fails with go error
I am trying to use xk6 prometheus remote write to send k6 data.
In GitLab pipeline trying to install xk6 on golang image but it fail with go error with some version issue.
GitLab job
run:k6:
stage: ...
0
votes
0
answers
50
views
How to add custom label with dynamic value in k6 logs with log-output forwarding?
The default message format for k6 with console.log is
time="2023-07-19T10:40:20Z" level=info msg="hello" source=console
I want to modify this message and let's say add a custom ...
0
votes
1
answer
55
views
Using response body from 1st request in 2nd request in k6
I'm sending res1 request, saving res1.body and want to use it as a body for post in res2.
However it doesn't have JSON structure but:
{\\n \\\"highlight\\\": {\\n \\\" (...)
I tried ...
0
votes
1
answer
367
views
How to execute single scenario out of multiple scenarios in a script in k6?
I have a k6 script with multiple scenarios configured, but I want to run only one at a time. How can I do this?
import http from "k6/http";
export const options = {
scenarios: {
...
0
votes
1
answer
77
views
K6 - Url redirection issue
I am having trouble with the redirection page during a browser test. Despite the sleep(10) and all the page.waitForNavigation() when I finally ask for page.title() the output is not the final page’s ...
0
votes
0
answers
88
views
Proper way to import JSLib into k6.io tests
I tried to follow guide of k6.io to import JS modules in the test:
https://jslib.k6.io/
My js tests can't load:
import { uuidv4 } from "https://jslib.k6.io/k6-utils/1.4.0/index.j"
//@ts-...
0
votes
0
answers
127
views
how to import a file from different folder in K6
im trying to import a file from different folder but it gives me an error.
enter image description here
Error:
ERRO[0000] GoError: The moduleSpecifier "../data/GetServerToken" couldn't be ...
0
votes
0
answers
38
views
Module Specifier error when running simple script.js on Windows Powershell/cmd prompt
After coming across k6, according to their documentation I created a simple Javascript file with the code given in their documentation, saved it. But when Im trying t run it, it is showing the below ...
0
votes
0
answers
37
views
How to use K6 to test dotnet webapi rate limits actually work
After adding rate limiters to a dotnet webapi, I would like to test that it actually work as intended and make sure to catch any unexpected changes.
For instance, given a TokenBucketRateLimiter with ...
0
votes
1
answer
79
views
postman-to-k6 sends request twice
I use postman-to-k6 to convert my postman collection to a k6 script. When the k6 script is run, there is 50% http_req_failed.
I realized that if it sends request to "temp. com/login", it ...
0
votes
1
answer
63
views
K6 - How to add elements to an empty array and calculate the average?
I am writing a test to calculate the average transfer time for each request.
import http from 'k6/http';
import { sleep } from 'k6';
import { check } from 'k6';
export let options = {
vus: 1,
...
1
vote
1
answer
43
views
How to log in to Liferay programmatically and avoid [JSONAction:92] User ... must be authenticated errors
I'm attempting to construct a k6 load test to exercise a WebSocket endpoint running in Liferay 7.1.
We're having issues with our WebSocket connections in production, so I'm trying to emulate the sign ...
0
votes
0
answers
38
views
Does k6 browser support url matching patterns for thresholds?
Im currently trying to write some tests for web app within k6 experimental browser.
While I can create a threshold like this, that works just fine:
thresholds: {
‘webvital_largest_content_paint{url:...
0
votes
1
answer
117
views
Understanding stages in ramping-arrival-rate
Here is my sample executor:
executor: 'ramping-arrival-rate',
timeUnit: '1m',
stages: [
{ target: 10000, duration: '1m' },
{ target: 20000, duration: '1m' },
{ target: 30000, duration: '1m'...
0
votes
1
answer
724
views
TypeError: Value is not an object: undefined
Here is my data.json file
"base_url": "https://gorest.co.in/public/v2/users"
Here is my k6 Sample.js
import http from 'k6/http';
import { check } from 'k6';
import { sleep } from '...
0
votes
1
answer
223
views
SyntaxError: Getting Unexpected Token, expected ;
Here is my json file
{
"base_url": "https://gorest.co.in/public/v2/users"
}
Here is my k6 script
import http from 'k6/http';
import { check } from 'k6';
import { sleep } from 'k6';...
0
votes
0
answers
114
views
TypeError: Cannot read property 'accessToken' of undefined in k6 tests
TypeError: Cannot read property 'accessToken' of undefined
I am have used postman to test an API using bearer token and it was running fine. However when I convert it to k6 i am unable to run the ...
0
votes
1
answer
124
views
Understanding rate in constant-arrival-rate executor
I’m using constant-arrival-rate executor and running 1170 req/sec.
{
executor: 'constant-arrival-rate',
duration: '1800s',
rate: 1170,
timeUnit: '1s',
preAllocatedVUs: 50,
maxVUs: 3500
}
...
0
votes
0
answers
72
views
K6 load test how to use Response.clickLink( [params] ) on button onClick event
I have two forms, first is Login Form and the second is Purchase Form as below:
<form id="login-form">
<div>
<label for="username">Username</label&...
0
votes
1
answer
257
views
Do functions wait for async methods to finish in K6?
So I have a bit of a question, that relates both to k6 and to I guess JavaScript itself. (Also I realize k6 is built upon Go language but uses JS).
Anyways in K6 you have a default function that looks ...
0
votes
0
answers
263
views
How to call scripts from K6 tests?
I am trying to run some scale up/down tests for kubernetes pods. I have written a following bash script
#!/bin/bash
# Use kubectl to update the number of replicas for the deployment
kubectl scale ...
0
votes
0
answers
142
views
K6 return timeout connexion errors
I tried a script k6 to test reset wiremock deployed on flexible engine environment but i received this error:
dial tcp 10.228.222.99:443: connectex: Une tentative de connexion a échoué car le parti ...
1
vote
0
answers
76
views
How to decode gzip string in k6
I get the compressed message from webSocket and want to decompress it into k6. I am trying to use pako library via a CDN but I get the ReferenceError: window is not defined
In the case of using pako ...
0
votes
0
answers
250
views
why does this k6 HTTP post fails?
I have a curl command that gets a valid response and a 200 code.
curl --location 'https://amazonURL/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization:...
0
votes
0
answers
41
views
Need to authenticate InfluxDB which is in Azure Cloud while sending k6 results from local machine
I have k6 scripts on my local Windows 10 machine. I want to write k6 execution results/stats to InfluxDB database which is hosted in Azure cloud server. Execution is working perfectly fine but not ...
0
votes
1
answer
334
views
k6 SharedArray support json values?
So im trying to load a .json file into a SharedArray according to the docs here: https://k6.io/docs/javascript-api/k6-data/sharedarray/
Right now my "load" function looks like this:
export ...
1
vote
0
answers
115
views
How can I configure SSL for a k6 client using a self-signed certificate on Redhat Linux?
I have tried to follow the documentation and used following code snippet:
tlsAuth: [
{
domains: ['example.com'],
cert: open('./mycert.pem'),
key: open('./mycert-key.pem'),
}
...
0
votes
0
answers
169
views
k6. How to use the imported SharedArray object? Is it possible to do so?
I want to import an already initialized SharedArray object from another file. I'm getting an error saying "SharedArray is not defined".
The code is very simplified, but I tried to maintain ...
0
votes
0
answers
20
views
How can I run docker commands inside Dockerfile for integrating into jenkins pipeline? [duplicate]
I'm trying to integrate grafana/k6 tests into the Jenkins pipeline, for that I have to integrate docker build and run commands into the Dockerfile. I was trying to do something like this:
FROM golang:...
0
votes
1
answer
181
views
How to get group duration timing in K6
I am using k6 versions k6 v0.43.1 ((devel), go1.20.1, darwin/amd64) on Mac OS ventura 13.2.1, and my requirement is to get the group timining for the request. I was trying this sample script
import ...
0
votes
1
answer
154
views
Testing Minio with K6, but despite large number of VUs sending, the number of requests is very small
I'm currently using K6 to load test a simple API that downloads objects from a Minio server. I am using NestJS to test the API. The main function being called is downloadObject, which downloads ...
0
votes
1
answer
370
views
K6 - measure average response time across all vus for a certain request out of group of requests
Hi I would like to measure the avg, highest response time of one specific request in a group of requests across all vus.
Can you please advice how to do that?
I can see the request in the results of ...