Skip to main content

K6

K6 check runs the k6 load testing suite and ingests the junit exported result in a container at a specified path as defined in testResults.

apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: k6-junit
spec:
interval: 120
severity: high
junit:
- testResults: "/tmp/"
name: k6-junit
display:
template: |
✅ {{.results.passed}} ❌ {{.results.failed}} in 🕑 {{.results.duration}}
{{ range $r := .results.suites}}
{{- if gt (conv.ToInt $r.failed) 0 }}
{{$r.name}} ✅ {{$r.passed}} ❌ {{$r.failed}} in 🕑 {{$r.duration}}
{{- end }}
{{- end }}
spec:
containers:
- name: k6
image: ghcr.io/flanksource/canary-k6:latest
command: ["/start.sh"]
tip

For a complete working example, take a look at canary-checker-examples/k6

FieldDescriptionSchemeRequired
specPod specificationv1.PodSpecYes
testResultsDirectory where the results will be publishedstringYes
timeoutTimeout in minutes to wait for specified container to finish its job. Defaults to 5 minutesint
*All other common fieldsCommon

Test Result Variables

NameDescriptionScehme
suites[]JunitSuite
passedNumber of passing testsint
failedNumber of failed testsint
skippedNUmber of tests that were skippedint
errorNumber of errors produced when running the testsint
durationTotal time in secondsfloat64

Junit Suite

NameDescriptionScheme
namestring
tests[]JunitTest
passedNumber of passing testsint
failedNumber of failed testsint
skippedNUmber of tests that were skippedint
errorNumber of errors produced when running the testsint
durationTotal time in secondsfloat64

Junit Test

NameDescriptionScheme
namestring
classnamean additional descriptor for the hierarchy of the test.string
durationTime in secondsfloat64
statusOne of passed, skipped, failed or errorstring
messageDescription optionally included with a skipped,string
propertiesAdditional info about the testmap[string]string
errorAny errors encountered when running ateststring
stdoutStandard output produced during teststring
stderrStandard error output produced during teststring