Addresses review feedback on #8640. fn-archive-max-size, fn-archive-max-files, fn-git-deploy-branch, and fn-git-keep-git-dir are renamed with `computed` in the function name so the names match the resolved-with-default semantic they implement, and every caller is updated in lockstep. logs:report renames the misordered --logs-vector-global-image and --logs-vector-global-networks to --logs-global-vector-image and --logs-global-vector-networks, makes the global getters return the raw stored value, and adds --logs-computed-vector-image, --logs-computed-vector-networks, and --logs-computed-vector-sink. network:report --global gains the computed-* keys for attach-post-create, attach-post-deploy, initial-network, and tld so external tooling can read the resolved value at global scope. The --quiet flag is dropped from every :report --format json | jq invocation across the PR's bats files; the report's --format json output is the only stdout and the flag is redundant.
98 lines
2.9 KiB
Bash
98 lines
2.9 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
setup() {
|
|
global_setup
|
|
create_app
|
|
}
|
|
|
|
teardown() {
|
|
dokku scheduler:set --global selected >/dev/null 2>&1 || true
|
|
destroy_app
|
|
global_teardown
|
|
}
|
|
|
|
@test "(scheduler) scheduler:help" {
|
|
run /bin/bash -c "dokku scheduler"
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_output_contains "Manage scheduler settings"
|
|
help_output="$output"
|
|
|
|
run /bin/bash -c "dokku scheduler:help"
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_output_contains "Manage scheduler settings"
|
|
assert_output "$help_output"
|
|
}
|
|
|
|
@test "(scheduler:report) selected raw vs computed vs global" {
|
|
run /bin/bash -c "dokku scheduler:set --global selected"
|
|
assert_success
|
|
|
|
run /bin/bash -c "dokku scheduler:report $TEST_APP --format json | jq -r '.\"scheduler-selected\"'"
|
|
assert_success
|
|
assert_output ""
|
|
|
|
run /bin/bash -c "dokku scheduler:report $TEST_APP --format json | jq -r '.\"scheduler-global-selected\"'"
|
|
assert_success
|
|
assert_output ""
|
|
|
|
run /bin/bash -c "dokku scheduler:report $TEST_APP --format json | jq -r '.\"scheduler-computed-selected\"'"
|
|
assert_success
|
|
assert_output "docker-local"
|
|
|
|
run /bin/bash -c "dokku scheduler:set --global selected null"
|
|
assert_success
|
|
|
|
run /bin/bash -c "dokku scheduler:report $TEST_APP --format json | jq -r '.\"scheduler-global-selected\"'"
|
|
assert_success
|
|
assert_output "null"
|
|
|
|
run /bin/bash -c "dokku scheduler:report $TEST_APP --format json | jq -r '.\"scheduler-computed-selected\"'"
|
|
assert_success
|
|
assert_output "null"
|
|
|
|
run /bin/bash -c "dokku scheduler:set $TEST_APP selected docker-local"
|
|
assert_success
|
|
|
|
run /bin/bash -c "dokku scheduler:report $TEST_APP --format json | jq -r '.\"scheduler-selected\"'"
|
|
assert_success
|
|
assert_output "docker-local"
|
|
|
|
run /bin/bash -c "dokku scheduler:report $TEST_APP --format json | jq -r '.\"scheduler-global-selected\"'"
|
|
assert_success
|
|
assert_output "null"
|
|
|
|
run /bin/bash -c "dokku scheduler:report $TEST_APP --format json | jq -r '.\"scheduler-computed-selected\"'"
|
|
assert_success
|
|
assert_output "docker-local"
|
|
|
|
run /bin/bash -c "dokku scheduler:set $TEST_APP selected"
|
|
assert_success
|
|
|
|
run /bin/bash -c "dokku scheduler:set --global selected"
|
|
assert_success
|
|
}
|
|
|
|
@test "(scheduler:report) --global --format json" {
|
|
run /bin/bash -c "dokku scheduler:set --global selected"
|
|
assert_success
|
|
|
|
run /bin/bash -c "dokku scheduler:report --global --format json | jq -e ."
|
|
assert_success
|
|
|
|
run /bin/bash -c "dokku scheduler:report --global --format json | jq -r '.\"scheduler-global-selected\"'"
|
|
assert_success
|
|
assert_output ""
|
|
|
|
run /bin/bash -c "dokku scheduler:report --global --format json | jq -r '.\"scheduler-computed-selected\"'"
|
|
assert_success
|
|
assert_output "docker-local"
|
|
|
|
run /bin/bash -c "dokku scheduler:report --global --format json | jq -r 'has(\"scheduler-selected\")'"
|
|
assert_success
|
|
assert_output "false"
|
|
}
|