Standardize how environment variables are migrated to properties during install triggers and migrate all remaining DOKKU_* config vars to their appropriate plugin properties. Adds a reusable MigrateConfigToProperties() function in the common package with Transform callback and ListProperty support, plus a migrate-config-to-property subcommand for the prop binary so shell plugins can use the same code path. Migrated variables and their new property owners: - DOKKU_APP_PROXY_TYPE/DOKKU_PROXY_TYPE → proxy type - DOKKU_DISABLE_PROXY → proxy disabled - DOKKU_PROXY_PORT → ports proxy-port - DOKKU_PROXY_SSL_PORT → ports proxy-ssl-port - DOKKU_APP_RESTORE → ps restore - DOKKU_SKIP_DEPLOY → ps skip-deploy - DOKKU_START_CMD → ps start-cmd - DOKKU_DOCKERFILE_START_CMD → ps dockerfile-start-cmd - DOKKU_DISABLE_APP_AUTOCREATION → apps disable-autocreation - DOKKU_APP_SHELL → scheduler shell - DOKKU_SKIP_CLEANUP → builder skip-cleanup - DOKKU_CHECKS_DISABLED → checks disabled - DOKKU_CHECKS_SKIPPED → checks skipped - DOKKU_CHECKS_WAIT → checks wait - DOKKU_CHECKS_TIMEOUT → checks timeout - DOKKU_CHECKS_ATTEMPTS → checks attempts - DOKKU_DEFAULT_CHECKS_WAIT → checks default-wait - DOKKU_SKIP_ALL_CHECKS → checks disabled (legacy) - DOKKU_SKIP_DEFAULT_CHECKS → checks skipped (legacy) Also refactors existing bespoke migration loops in scheduler, ports, ps, builder, and nginx-vhosts plugins to use the standardized utility. Removes DOKKU_PARALLEL_ARGUMENTS from documentation (unused in core). Deprecates fn-migrate-config-to-property bash function. closes #1558
82 lines
2.4 KiB
Bash
82 lines
2.4 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
source "$PLUGIN_CORE_AVAILABLE_PATH/config/functions"
|
|
|
|
setup() {
|
|
global_setup
|
|
[[ -f "$DOKKU_ROOT/VHOST" ]] && cp -fp "$DOKKU_ROOT/VHOST" "$DOKKU_ROOT/VHOST.bak"
|
|
}
|
|
|
|
teardown() {
|
|
detach_delete_network
|
|
destroy_app
|
|
[[ -f "$DOKKU_ROOT/VHOST.bak" ]] && mv "$DOKKU_ROOT/VHOST.bak" "$DOKKU_ROOT/VHOST" && chown dokku:dokku "$DOKKU_ROOT/VHOST"
|
|
global_teardown
|
|
}
|
|
|
|
@test "(nginx-vhosts) proxy:build-config (sslip.io style hostnames)" {
|
|
echo "127.0.0.1.sslip.io.${DOKKU_DOMAIN}" >"$DOKKU_ROOT/VHOST"
|
|
run deploy_app
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_success
|
|
|
|
check_urls "http://${TEST_APP}.127.0.0.1.sslip.io.${DOKKU_DOMAIN}"
|
|
assert_http_success "http://${TEST_APP}.127.0.0.1.sslip.io.${DOKKU_DOMAIN}"
|
|
}
|
|
|
|
@test "(nginx-vhosts) proxy:build-config (dockerfile expose)" {
|
|
run deploy_app dockerfile
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_success
|
|
|
|
run /bin/bash -c "dokku domains:add $TEST_APP www.test.app.${DOKKU_DOMAIN}"
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_success
|
|
|
|
check_urls "http://${TEST_APP}.${DOKKU_DOMAIN}:3000"
|
|
check_urls "http://${TEST_APP}.${DOKKU_DOMAIN}:3003"
|
|
check_urls "http://www.test.app.${DOKKU_DOMAIN}:3000"
|
|
check_urls "http://www.test.app.${DOKKU_DOMAIN}:3003"
|
|
assert_http_localhost_response "http" "${TEST_APP}.${DOKKU_DOMAIN}" "3000"
|
|
assert_http_localhost_response "http" "${TEST_APP}.${DOKKU_DOMAIN}" "3003"
|
|
assert_http_localhost_response "http" "www.test.app.${DOKKU_DOMAIN}" "3000"
|
|
assert_http_localhost_response "http" "www.test.app.${DOKKU_DOMAIN}" "3003"
|
|
}
|
|
|
|
@test "(nginx-vhosts) proxy:build-config (multiple networks)" {
|
|
run deploy_app
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_success
|
|
|
|
create_attach_network
|
|
run /bin/bash -c "dokku proxy:build-config $TEST_APP"
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_success
|
|
}
|
|
|
|
@test "(nginx-vhosts) proxy:build-config (global proxy-port)" {
|
|
local GLOBAL_PORT=30999
|
|
run /bin/bash -c "dokku ports:set --global proxy-port ${GLOBAL_PORT}"
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_success
|
|
|
|
run deploy_app
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_success
|
|
check_urls "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}"
|
|
assert_http_success "http://${TEST_APP}.${DOKKU_DOMAIN}:${GLOBAL_PORT}"
|
|
|
|
run /bin/bash -c "dokku ports:set --global proxy-port"
|
|
echo "output: $output"
|
|
echo "status: $status"
|
|
assert_success
|
|
}
|