fix: do not allow reusing the same scheme:host-port mappings when setting ports

This doesn't make sense as a port can't be listened to twice on the same domain, so instead we should just fail immediately if someone attempts to perform this action.

Refs dokku/dokku-letsencrypt#269
This commit is contained in:
Jose Diaz-Gonzalez
2024-02-25 11:10:36 -05:00
parent 412c841860
commit ba3ad4a9ab
5 changed files with 93 additions and 9 deletions

View File

@@ -54,6 +54,26 @@ teardown() {
echo "status: $status"
assert_success
run /bin/bash -c "dokku ports:set $TEST_APP http:8080:5000 https:8443:5000 http:1234:5001 http:1234:5002"
echo "output: $output"
echo "status: $status"
assert_failure
run /bin/bash -c "dokku ports:add $TEST_APP http:12345:5003 http:12345:5004"
echo "output: $output"
echo "status: $status"
assert_failure
run /bin/bash -c "dokku ports:add $TEST_APP http:1234:5003 http:12345:5004"
echo "output: $output"
echo "status: $status"
assert_failure
run /bin/bash -c "dokku ports:add $TEST_APP http:1234:5001"
echo "output: $output"
echo "status: $status"
assert_failure
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map"
echo "output: $output"
echo "status: $status"