1b5ad035d9
docker: add missing fonts for rasterized graphviz output formats add missing license header kg: do not export handlers use http package for status codes keep checks for errors in a single line simplify error message about failed invocation of dot pass node hostname and subnet to graph handler use SVG as default format for graph handler register health handler with HandleFunc add option for selecting layout to graph handler and using circo as new default e2e: add tests for HTTP handlers e2e: fix and simplify handler tests add should comments to assertions e2s: use assert_fail instead of assert _not add missing mime-type header for graph handler use switch/case statements for validating formats / layouts e2e: fix handlers tests Co-authored-by: leonnicolas <60091705+leonnicolas@users.noreply.github.com> graph-handler: add missing font to Dockerfile Dockerfile: remove unnecessary font This commit leaves Noto as the only font package, as one font package is sufficient for the container. Signed-off-by: Lucas Servén Marín <lserven@gmail.com>
27 lines
1.3 KiB
Bash
27 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
# shellcheck disable=SC1091
|
|
. lib.sh
|
|
|
|
setup_suite() {
|
|
# shellcheck disable=SC2016
|
|
block_until_ready_by_name kube-system kilo-userspace
|
|
_kubectl wait pod -l app.kubernetes.io/name=adjacency --for=condition=Ready --timeout 3m
|
|
}
|
|
|
|
test_graph_handler() {
|
|
assert "curl_pod 'http://10.4.0.1:1107/graph?format=svg&layout=circo' | grep -q '<svg'" "graph handler should produce SVG output"
|
|
assert "curl_pod http://10.4.0.1:1107/graph?layout=circo | grep -q '<svg'" "graph handler should default to SVG output"
|
|
assert "curl_pod http://10.4.0.1:1107/graph | grep -q '<svg'" "graph handler should default to SVG output"
|
|
assert_fail "curl_pod http://10.4.0.1:1107/graph?layout=fake | grep -q '<svg'" "graph handler should reject invalid layout"
|
|
assert_fail "curl_pod http://10.4.0.1:1107/graph?format=fake | grep -q '<svg'" "graph handler should reject invalid format"
|
|
}
|
|
|
|
test_health_handler() {
|
|
assert "curl_pod http://10.4.0.1:1107/health" "health handler should return a status code of 200"
|
|
}
|
|
|
|
test_metrics_handler() {
|
|
assert "curl_pod http://10.4.0.1:1107/metrics" "metrics handler should return a status code of 200"
|
|
assert "(( $(curl_pod http://10.4.0.1:1107/metrics | grep -E ^kilo_nodes | cut -d " " -f 2) > 0 ))" "metrics handler should provide metric: kilo_nodes > 0"
|
|
}
|