Skip to content

Commit b48a319

Browse files
fweikertcopybara-github
authored andcommitted
Fix IPv6-related network issues in some shell tests.
PiperOrigin-RevId: 638314617 Change-Id: Ia6a3f63f998e9cfd3512d2c6a17c622c2ac60846
1 parent 29e9a9d commit b48a319

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/test/shell/bazel/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ sh_test(
448448
tags = [
449449
"no-sandbox",
450450
"no_windows",
451+
"requires-network", # For Bzlmod
451452
],
452453
)
453454

src/test/shell/bazel/bazel_test_test.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,16 @@ sh_test(
174174
)
175175
EOF
176176

177+
# The next line ensures that the test passes in IPv6-only networks on macOS.
178+
if is_darwin; then
179+
export JAVA_TOOL_OPTIONS="-Djava.net.preferIPv6Addresses=true"
180+
export STARTUP_OPTS="--host_jvm_args=-Djava.net.preferIPv6Addresses=true"
181+
else
182+
export STARTUP_OPTS=""
183+
fi
184+
177185
# Test BAR is set from --action_env
178-
BAZ=fromaction bazel --ignore_all_rc_files test --test_output=all \
186+
BAZ=fromaction bazel --ignore_all_rc_files $STARTUP_OPTS test --test_output=all \
179187
--action_env=BAR=fromcli --action_env=BAZ \
180188
//foo &> $TEST_log || fail "Test failed"
181189
expect_log "foo: frombuild"
@@ -187,7 +195,7 @@ EOF
187195
# Test FOO from the BUILD file wins
188196
# Test BAR is set from --test_env
189197
# Test BAZ is set from --test_env
190-
BAZ=fromtest bazel --ignore_all_rc_files test --test_output=all \
198+
BAZ=fromtest bazel --ignore_all_rc_files $STARTUP_OPTS test --test_output=all \
191199
--action_env=FOO=fromcli --test_env=FOO=fromcli --test_env=BAR=fromcli \
192200
--test_env=BAZ //foo &> $TEST_log || fail "Test failed"
193201
expect_log "foo: frombuild"

src/test/shell/integration/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ sh_test(
129129
"@bazel_tools//tools/bash/runfiles",
130130
],
131131
shard_count = 8,
132+
tags = [
133+
"requires-network", # For Bzlmod
134+
],
132135
)
133136

134137
sh_test(

0 commit comments

Comments
 (0)