JUnit
Standard Edition RequiredJUnit check performs a Unit test, parses the JUnit test reports in a container at a specified path as defined in testResults
.
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: junit-check
annotations:
trace: "true"
spec:
interval: 120
owner: DBAdmin
severity: high
spec:
junit:
- testResults: "/tmp/junit-results/"
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: jes
image: docker.io/tarun18/junit-test-pass
command: ["/start.sh"]
Field | Description | Scheme | Required |
---|---|---|---|
spec | Pod specification | v1.PodSpec | Yes |
testResults | Directory where the results will be published | string | Yes |
timeout | Timeout in minutes to wait for specified container to finish its job. Defaults to 5 minutes | int | |
name | Name of the check, must be unique within the canary | string | Yes |
artifacts | Specify what files/folders generated by the script needs to be archived | []Artifact | |
description | Description for the check | string | |
icon | Icon for overwriting default icon on the dashboard | string | |
labels | Labels for check | map[string]string | |
test | Evaluate whether a check is healthy | Expression | |
display | Expression to change the formatting of the display | Expression | |
transform | Transform data from a check into multiple individual checks | Expression | |
metrics | Metrics to export from | []Metrics |
Test Result Variables
Name | Description | Scheme |
---|---|---|
suites | []JunitSuite | |
passed | Number of passing tests | int |
failed | Number of failed tests | int |
skipped | NUmber of tests that were skipped | int |
error | Number of errors produced when running the tests | int |
duration | Total time in seconds | float64 |
Junit Suite
Name | Description | Scheme |
---|---|---|
name | string | |
tests | []JunitTest | |
passed | Number of passing tests | int |
failed | Number of failed tests | int |
skipped | NUmber of tests that were skipped | int |
error | Number of errors produced when running the tests | int |
duration | Total time in seconds | float64 |
Junit Test
Name | Description | Scheme |
---|---|---|
name | string | |
classname | an additional descriptor for the hierarchy of the test. | string |
duration | Time in seconds | float64 |
status | One of passed , skipped , failed or error | string |
message | Description optionally included with a skipped, | string |
properties | Additional info about the test | map[string]string |
error | Any errors encountered when running atest | string |
stdout | Standard output produced during test | string |
stderr | Standard error output produced during test | string |
Artifact
Field | Description | Type | Required |
---|---|---|---|
path | Path or glob. | string | true |
See artifacts