Skip to content

localz/testkube-executor-k6

 
 

Repository files navigation

Testkube Logo

Welcome to TestKube k6 Executor

TestKube k6 Executor is a test executor to run k6 load tests with TestKube.

Usage

You need to register and deploy the executor in your cluster. Additionally, you may deploy InfluxDB as well as Grafana if you need detailed performance data from your tests.

kubectl apply -f examples/k6-executor.yaml

# see https://k6.io/docs/results-visualization/influxdb-+-grafana/
kubectl apply -f examples/k6-influxdb-grafana.yaml

Have a look at the k6 documentation for details on writing tests. Here is a simple example script:

import http from 'k6/http';
import { sleep } from 'k6';

export default function () {
  http.get('https://kubeshop.github.io/testkube/');
  sleep(1);
}

Issue the following commands to create and start the script:

kubectl testkube create test --file examples/k6-test-script.js --type "k6/script" --name k6-test-script
kubectl testkube run test --watch k6-test-script

Examples

# run k6-test-script.js from this Git repository
kubectl testkube create test --git-uri https://github.com/kubeshop/testkube-executor-k6.git --git-branch main --git-path examples --type "k6/script" --name k6-test-script-git
kubectl testkube run test --args examples/k6-test-script.js --watch k6-test-script-git

# for local k6 execution use k6/run or k6/script (deprecated)
kubectl testkube create test --file examples/k6-test-script.js --type "k6/run" --name k6-local-test

# you can also run test scripts using k6 cloud
# you need to pass the API token as test param
kubectl testkube create test --file examples/k6-test-script.js --type "k6/cloud" --name k6-cloud-test
kubectl testkube run test --param K6_CLOUD_TOKEN=K6_CLOUD_TOKEN=<YOUR_K6_CLOUD_API_TOKEN> --watch k6-cloud-test

Issues and enchancements

Please follow the main TestKube repository for reporting any issues or discussions

Testkube

For more info go to main testkube repo

Release Releases Go version

Docker builds Code build Release date

Twitter Discord

Packages

No packages published

Languages

  • Go 88.3%
  • Makefile 7.3%
  • Dockerfile 3.3%
  • HCL 1.1%