Skip to content

Commit 57abc77

Browse files
authored
Merge pull request #70 from Senthil455/fix/chaos-network-delay-package-mgr
fix: support multiple package managers in chaos network-delay test
2 parents 27f0b68 + 0bd1634 commit 57abc77

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/chaos/network-delay.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,17 @@ log_info "Step 4: Injecting ${DELAY_MS}ms network delay to $POSTGRES_CONTAINER..
120120

121121
if ! docker exec "$POSTGRES_CONTAINER" sh -c "command -v tc" 2>/dev/null; then
122122
log_info "Installing iproute2..."
123-
docker exec "$POSTGRES_CONTAINER" apk add -q iproute2 2>/dev/null || true
123+
docker exec "$POSTGRES_CONTAINER" sh -c "
124+
if command -v apk >/dev/null 2>&1; then
125+
apk add -q iproute2 2>/dev/null || true
126+
elif command -v apt-get >/dev/null 2>&1; then
127+
apt-get update -qq && apt-get install -y -qq iproute2 2>/dev/null || true
128+
elif command -v yum >/dev/null 2>&1; then
129+
yum install -y -q iproute 2>/dev/null || true
130+
elif command -v dnf >/dev/null 2>&1; then
131+
dnf install -y -q iproute 2>/dev/null || true
132+
fi
133+
" || true
124134
fi
125135

126136
INJECT_RESULT=$(docker exec "$POSTGRES_CONTAINER" sh -c "

0 commit comments

Comments
 (0)