My CRD contains the following arguments
spec:
parallelism: 1
arguments: --vus 1 --duration 1m --http-debug --out statsd
my script doesn’t contain any options and the default function only contains 2 requests, each with a 5 second sleep between them.
Taking all of this into consideration, my test should only complete 12 requests and 6 iterations however 6522 requests were sent… This only happens when using the k6 operator. Testing the same script locally works as expected
Hi @jokekpe,
Welcome to the forum! Could you please post your script and both outputs, with k6-operator and without it? Also, which command line do you use to run k6 without k6-operator?
Thanks.
1 Like
Locally, without k6 operator
script:
import http from 'k6/http';
import { sleep, check } from 'k6';
let body;
let response;
let service_token;
export default function () {
// our HTTP request, note that we are saving the response to res, which can be accessed later
body = JSON.stringify(
{
"email": "REDACTED",
"token_duration": "short"
})
response = http.post(
'REDACTED',
body,
{
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
}
}
)
service_token = JSON.parse(response.body)["service_token"]
sleep(5);
body = JSON.stringify(
{
"requests":[
{
"request_id":"1",
"action":"create",
"resource":{
"uri":"REDACTED",
"scope":{
"organization":"REDACTED",
"billing_features":[
"user_groups"
]
}
}
}
]
})
response = http.post(
'REDACTED',
body,
{
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${service_token}`
}
}
)
sleep(5);
}
CLI command: k6 --vus 1 --duration 1m path/to/script.js
results
Locally in K8s w/ k6 operator
CRD:
apiVersion: k6.io/v1alpha1
kind: K6
metadata:
name: k6-authorization
spec:
parallelism: 1
arguments: --vus 1 --duration 1m
quiet: "false"
script:
configMap:
# Remember...we created the 'test-scripts' ConfigMap with the available scripts inside.
# Recreate the ConfigMag if you modify scripts or want additional scripts.
name: test-scripts
# TODO - Want a different test script? Change it here.
file: authorization.js
- same script as above
- same results
Looks like I’m only seeing the strange behavior when testing this while inside my orgs cluster…The k6-operator-controller-manager
hasn’t been restarted in quite some time… I wonder if this might be the issue
Went scorched earth and re-applied the CRD and everything worked as expected… thanks for the help here!
2 Likes