Skip to content

Commit 7b7ae48

Browse files
committed
Configured emulator DNS server and added resolution checks in CI scripts
1 parent c3a92ab commit 7b7ae48

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

script/ci-setup-and-run-emulator.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ cat "$HOME/.android/avd/${AVD_NAME}.avd/config.ini"
4242
-wipe-data \
4343
-gpu swiftshader_indirect \
4444
-read-only \
45-
-no-metrics &
45+
-no-metrics \
46+
-dns-server 10.0.2.2 &

script/ci-wait-for-emulator.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ adb shell "iptables -t nat -A OUTPUT -s 127.0.0.1 -p tcp --dport 443 -j REDIRECT
3232
# Forwards requests on a specific host port to a different port on a device.
3333
adb forward tcp:1212 tcp:1212
3434

35+
# Print DNS configuration for easier CI debugging.
36+
adb shell getprop net.dns1 || true
37+
adb shell getprop net.dns2 || true
38+
3539
# Check that the emulator has internet connection.
3640
for attempt in {1..5}; do
3741
if adb shell "ping -c 1 www.google.com"; then
@@ -46,5 +50,21 @@ for attempt in {1..5}; do
4650
sleep 2
4751
done
4852

53+
# Check that Android emulator can resolve FlowCrypt test domains.
54+
# Host-side dnsmasq resolving is not enough: the emulator has its own DNS configuration.
55+
for attempt in {1..5}; do
56+
if adb shell "ping -c 1 fes.flowcrypt.test"; then
57+
break
58+
fi
59+
60+
if [[ "$attempt" -eq 5 ]]; then
61+
echo "Emulator can't resolve fes.flowcrypt.test"
62+
echo "Make sure ci-setup-and-run-emulator.sh starts emulator with: -dns-server 10.0.2.2"
63+
exit 1
64+
fi
65+
66+
sleep 2
67+
done
68+
4969
echo "Emulator is ready"
50-
set +o xtrace
70+
set +o xtrace

0 commit comments

Comments
 (0)