Files
dokku/tests/unit/scheduler-k3s-charts-2.bats
Jose Diaz-Gonzalez b8929712d4 fix: persist scheduler-k3s chart overrides as JSON maps
Chart property names containing `/` failed because per-key flat-file storage interpreted the slash as a filesystem path separator, and any move to line-based storage would silently truncate multi-line values. A new `PropertyMap*` helper family in `common` persists each map as a single JSON file so both `/` in keys and `\n` in values round-trip losslessly. Chart overrides move to `chart-overrides.<chart>` and an idempotent `TriggerInstall` migration rewrites any legacy `chart.<chart>.<key>` files into the new layout. The deprecated `scheduler-k3s:set --global chart.*` form is rerouted through the same map storage so it does not silently orphan writes. Closes #8717.
2026-05-31 01:54:28 -04:00

58 lines
2.0 KiB
Bash

#!/usr/bin/env bats
load test_helper
setup() {
global_setup
}
teardown() {
dokku scheduler-k3s:charts:set traefik.service.annotations.prometheus.io/scrape >/dev/null 2>/dev/null || true
dokku scheduler-k3s:charts:set traefik.controller.config >/dev/null 2>/dev/null || true
dokku scheduler-k3s:charts:set cert-manager.installCRDs >/dev/null 2>/dev/null || true
global_teardown
}
@test "(scheduler-k3s:charts:set) accepts property names containing /" {
run /bin/bash -c "dokku scheduler-k3s:charts:set traefik.service.annotations.prometheus.io/scrape true"
assert_success
run /bin/bash -c "dokku scheduler-k3s:charts:report traefik --format json | jq -r '.\"traefik.service.annotations.prometheus.io/scrape\"'"
assert_success
assert_output "true"
run /bin/bash -c "dokku scheduler-k3s:charts:set traefik.service.annotations.prometheus.io/scrape"
assert_success
run /bin/bash -c "dokku scheduler-k3s:charts:report traefik --format json"
assert_success
assert_output "{}"
}
@test "(scheduler-k3s:charts:set) preserves multi-line values" {
local value=$'line one\nline two\nline three'
run /bin/bash -c "dokku scheduler-k3s:charts:set traefik.controller.config \"$value\""
assert_success
run /bin/bash -c "dokku scheduler-k3s:charts:report traefik --format json | jq -r '.\"traefik.controller.config\"'"
assert_success
assert_output "$value"
}
@test "(scheduler-k3s:set) deprecated chart.* form writes through map storage" {
run /bin/bash -c "dokku scheduler-k3s:set --global chart.cert-manager.installCRDs false"
assert_success
assert_output_contains "deprecated"
run /bin/bash -c "dokku scheduler-k3s:charts:report cert-manager --format json | jq -r '.\"cert-manager.installCRDs\"'"
assert_success
assert_output "false"
run /bin/bash -c "dokku scheduler-k3s:set --global chart.cert-manager.installCRDs"
assert_success
run /bin/bash -c "dokku scheduler-k3s:charts:report cert-manager --format json"
assert_success
assert_output "{}"
}