From 438b93984f1495645c5379bb2e99358dbc21c430 Mon Sep 17 00:00:00 2001 From: Mark Yen Date: Tue, 2 Jul 2024 18:16:54 -0700 Subject: [PATCH] BATS: registry/creds: fix for tunnelled network This makes the registry/creds BATS test work with tunnelled network, by using the appropriate fixed IP address for the network namespace. Signed-off-by: Mark Yen --- bats/tests/registry/creds.bats | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bats/tests/registry/creds.bats b/bats/tests/registry/creds.bats index 548e6056222..8a0c5bd9be6 100644 --- a/bats/tests/registry/creds.bats +++ b/bats/tests/registry/creds.bats @@ -39,8 +39,13 @@ local_setup() { # Essentially localhost, but needs to be a routable IP that also works # from inside a container. Will be turned into a DNS name using sslip.io. if is_windows; then - # In WSL all distros have the same IP address - ipaddr="$(ip a show eth0 | awk '/inet / {sub("/.*",""); print $2}')" + if using_networking_tunnel; then + # When using network tunnel, use a fixed address. + ipaddr="192.168.1.2" + else + # In WSL all distros have the same IP address + ipaddr="$(ip a show eth0 | awk '/inet / {sub("/.*",""); print $2}')" + fi else # Lima uses a fixed hard-coded IP address ipaddr="192.168.5.15"