Skip to content

Commit e4e8d6b

Browse files
committed
test migration against the legacy DNS topology
1 parent 83b5e2a commit e4e8d6b

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

tests/e2e-vpn.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ trap cleanup EXIT
171171
# ---------------------------------------------------------------------------
172172
start_stack() {
173173
local profile="$1" peers="${2:-}"
174+
local stack_subnet="${3:-$TEST_SUBNET}"
175+
local stack_pihole_ip="${4:-$TEST_PIHOLE_IP}"
176+
local stack_unbound_ip="${5:-$TEST_UNBOUND_IP}"
174177

175178
WORK_DIR="$(mktemp -d)"
176179
PROJECT="wirehole-e2e-$$-${profile}"
@@ -199,10 +202,10 @@ start_stack() {
199202
set_var VPN_PORT "$TEST_VPN_PORT"
200203
set_var PIHOLE_PASSWORD "$TEST_PASSWORD"
201204
set_var WG_EASY_PASSWORD "$TEST_PASSWORD"
202-
set_var WIREHOLE_SUBNET "$TEST_SUBNET"
205+
set_var WIREHOLE_SUBNET "$stack_subnet"
203206
set_var VPN_SUBNET "$TEST_WG_EASY_SUBNET"
204-
set_var PIHOLE_IPV4_ADDRESS "$TEST_PIHOLE_IP"
205-
set_var UNBOUND_IPV4_ADDRESS "$TEST_UNBOUND_IP"
207+
set_var PIHOLE_IPV4_ADDRESS "$stack_pihole_ip"
208+
set_var UNBOUND_IPV4_ADDRESS "$stack_unbound_ip"
206209
set_var WIREGUARD_INTERNAL_SUBNET "10.98.13.0"
207210
set_var PIHOLE_WEB_PORT "$TEST_PIHOLE_PORT"
208211
set_var WG_EASY_UI_PORT "$TEST_UI_PORT"
@@ -220,6 +223,7 @@ start_stack() {
220223
# ---------------------------------------------------------------------------
221224
connect_and_test_client() {
222225
local label="$1" conf="$2" server_vpn_ip="$3" endpoint="${4:-}"
226+
local dns_ip="${5:-$TEST_PIHOLE_IP}"
223227
local suffix name
224228
suffix="$(tr -dc 'a-z0-9' <<< "$label" | head -c 12)"
225229
name="wirehole-e2e-client-$$-${suffix}"
@@ -291,14 +295,14 @@ connect_and_test_client() {
291295
fi
292296

293297
local r
294-
r="$(docker exec "$name" dig +short +time=8 example.com @"$TEST_PIHOLE_IP" 2> /dev/null | head -1)"
298+
r="$(docker exec "$name" dig +short +time=8 example.com @"$dns_ip" 2> /dev/null | head -1)"
295299
if [[ $r =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
296300
ok "$label: resolves names through Pi-hole ($r)"
297301
else
298302
bad "$label: cannot use Pi-hole through the tunnel"
299303
fi
300304

301-
r="$(docker exec "$name" dig +short +time=8 doubleclick.net @"$TEST_PIHOLE_IP" 2> /dev/null | head -1)"
305+
r="$(docker exec "$name" dig +short +time=8 doubleclick.net @"$dns_ip" 2> /dev/null | head -1)"
302306
if [[ $r == "0.0.0.0" ]]; then
303307
ok "$label: advertisements are blocked"
304308
else
@@ -770,7 +774,10 @@ run_wireguard() {
770774
run_migration() {
771775
say "Migration from the legacy LinuxServer layout"
772776

773-
if ! start_stack wireguard "legacy"; then
777+
# The old Compose file hardcoded this Docker network and Pi-hole address.
778+
# Use the real legacy topology so the old client DNS setting remains valid
779+
# after migration to the new defaults.
780+
if ! start_stack wireguard "legacy" "10.2.0.0/24" "10.2.0.100" "10.2.0.200"; then
774781
bad "The migration fixture did not start"
775782
tail -20 /tmp/e2e-up.log
776783
return 1
@@ -859,7 +866,7 @@ run_migration() {
859866
bad "Migration changed the existing client configuration"
860867
fi
861868

862-
connect_and_test_client "migrated-legacy" "$old_conf" "10.98.13.1"
869+
connect_and_test_client "migrated-legacy" "$old_conf" "10.98.13.1" "" "10.2.0.100"
863870
teardown
864871
}
865872

0 commit comments

Comments
 (0)