mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-03-27 15:27:53 +08:00
tests: Fix intermittent namespace conflicts in CI
Fix PID-based namespace name collisions by: - Extracting last 9 digits of PID (instead of first 4) - Shortening interface names to fit 15-character IFNAMSIZ limit Signed-off-by: Grigory Trenin <grigory.trenin@gmail.com>
This commit is contained in:
18
tests/ns.sh
18
tests/ns.sh
@@ -75,13 +75,17 @@ trap nsfinish EXIT
|
||||
|
||||
echo " * Setting up namespaces..."
|
||||
set -e
|
||||
NSNAME1="ocserv-c-tmp-${$:0:4}"
|
||||
NSNAME3="ocserv-c-2-tmp-${$:0:4}"
|
||||
NSNAME2="ocserv-s-tmp-${$:0:4}"
|
||||
ETHNAME1="oceth-c${$:0:4}"
|
||||
ETHNAME2="oceth-s${$:0:4}"
|
||||
ETHNAME3="oceth-c-2${$:0:4}"
|
||||
ETHNAME4="oceth-s-2${$:0:4}"
|
||||
|
||||
# Extract last 9 characters of PID (or entire PID if shorter)
|
||||
test ${#$} -ge 9 && pid_trunc="${$: -9}" || pid_trunc=$$
|
||||
|
||||
NSNAME1="ocserv-c-tmp-${pid_trunc}"
|
||||
NSNAME3="ocserv-c-2-tmp-${pid_trunc}"
|
||||
NSNAME2="ocserv-s-tmp-${pid_trunc}"
|
||||
ETHNAME1="ocen1c${pid_trunc}"
|
||||
ETHNAME2="ocen2s${pid_trunc}"
|
||||
ETHNAME3="ocen3c${pid_trunc}"
|
||||
ETHNAME4="ocen4s${pid_trunc}"
|
||||
|
||||
${IP} netns add ${NSNAME1}
|
||||
${IP} netns add ${NSNAME2}
|
||||
|
||||
Reference in New Issue
Block a user