Skip to content

Commit 1802aa2

Browse files
abueideclaude
andcommitted
fix(tests): keep simulator/emulator processes alive for readiness probes
Process-compose readiness probes only fire while a process is running. In non-pure mode, simulator/emulator processes exited immediately after starting, so the probe never fired and downstream processes waiting on process_healthy blocked forever. Fix: always keep simulator/emulator processes alive with tail -f /dev/null (process-compose services pattern). Also pass --pure flag explicitly to ios.sh/android.sh when IN_NIX_SHELL=pure, and make android.sh self- initializing by auto-sourcing setup.sh when ANDROID_SDK_ROOT is missing. Verified: iOS E2E (non-pure) and Android E2E (non-pure) both pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 220ad10 commit 1802aa2

8 files changed

Lines changed: 34 additions & 29 deletions

File tree

examples/android/tests/test-suite.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ processes:
3838
3939
if [ "${IN_NIX_SHELL:-}" = "pure" ] || [ "${DEVBOX_PURE_SHELL:-}" = "1" ]; then
4040
echo "Starting fresh Android emulator (pure mode): $device"
41-
android.sh emulator start "$device"
41+
android.sh emulator start --pure "$device"
4242
else
4343
echo "Starting Android emulator: $device"
44-
# In non-pure mode, don't run foreground - start in background and wait
4544
unset ANDROID_EMULATOR_FOREGROUND
4645
android.sh emulator start "$device"
47-
48-
echo "Emulator will remain running after tests complete"
49-
exit 0
5046
fi
47+
# Keep process alive for readiness probe (process-compose services pattern)
48+
tail -f /dev/null
5149
availability:
5250
restart: "no"
5351
readiness_probe:

examples/ios/tests/test-suite.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ processes:
2626
# Phase 3: Start simulator - depends on sync completing
2727
ios-simulator:
2828
command: |
29-
ios.sh simulator start ${IOS_DEVICE}
30-
31-
# In pure mode, keep process alive so cleanup can shut down test simulator
3229
if [ "${IN_NIX_SHELL:-}" = "pure" ] || [ "${DEVBOX_PURE_SHELL:-}" = "1" ]; then
33-
tail -f /dev/null
30+
ios.sh simulator start --pure ${IOS_DEVICE}
31+
else
32+
ios.sh simulator start ${IOS_DEVICE}
3433
fi
34+
# Keep process alive for readiness probe (process-compose services pattern)
35+
tail -f /dev/null
3536
depends_on:
3637
sync-simulators:
3738
condition: process_completed_successfully

examples/react-native/tests/dev-android.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ processes:
4949
device="${ANDROID_DEFAULT_DEVICE:-max}"
5050
echo "Starting emulator: $device"
5151
android.sh emulator start "$device"
52-
53-
echo "Emulator will remain running for hot reload"
52+
# Keep process alive for readiness probe (process-compose services pattern)
53+
tail -f /dev/null
5454
availability:
5555
restart: "no"
5656
readiness_probe:

examples/react-native/tests/dev-ios.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ processes:
5151
echo "Starting iOS simulator (${IOS_DEVICE})..."
5252
ios.sh simulator start ${IOS_DEVICE}
5353
echo "Simulator ready for development"
54-
echo "Simulator will remain running for hot reload"
54+
# Keep process alive for readiness probe (process-compose services pattern)
55+
tail -f /dev/null
5556
depends_on:
5657
sync-simulators:
5758
condition: process_completed_successfully

examples/react-native/tests/test-suite-all-e2e.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,14 @@ processes:
7575
7676
if [ "${IN_NIX_SHELL:-}" = "pure" ] || [ "${DEVBOX_PURE_SHELL:-}" = "1" ]; then
7777
echo "Starting fresh Android emulator (pure mode): $device"
78-
android.sh emulator start "$device"
78+
android.sh emulator start --pure "$device"
7979
else
8080
echo "Starting Android emulator: $device"
8181
unset ANDROID_EMULATOR_FOREGROUND
8282
android.sh emulator start "$device"
83-
84-
echo "Emulator will remain running after tests complete"
85-
exit 0
8683
fi
84+
# Keep process alive for readiness probe (process-compose services pattern)
85+
tail -f /dev/null
8786
availability:
8887
restart: "no"
8988
readiness_probe:
@@ -98,12 +97,13 @@ processes:
9897
# Phase 4b: Start iOS simulator (parallel with Android)
9998
ios-simulator:
10099
command: |
101-
ios.sh simulator start ${IOS_DEVICE}
102-
103-
# In pure mode, keep process alive so cleanup can shut down test simulator
104100
if [ "${IN_NIX_SHELL:-}" = "pure" ] || [ "${DEVBOX_PURE_SHELL:-}" = "1" ]; then
105-
tail -f /dev/null
101+
ios.sh simulator start --pure ${IOS_DEVICE}
102+
else
103+
ios.sh simulator start ${IOS_DEVICE}
106104
fi
105+
# Keep process alive for readiness probe (process-compose services pattern)
106+
tail -f /dev/null
107107
depends_on:
108108
sync-simulators:
109109
condition: process_completed_successfully

examples/react-native/tests/test-suite-android-e2e.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,14 @@ processes:
5050
5151
if [ "${IN_NIX_SHELL:-}" = "pure" ] || [ "${DEVBOX_PURE_SHELL:-}" = "1" ]; then
5252
echo "Starting fresh Android emulator (pure mode): $device"
53-
android.sh emulator start "$device"
53+
android.sh emulator start --pure "$device"
5454
else
5555
echo "Starting Android emulator: $device"
5656
unset ANDROID_EMULATOR_FOREGROUND
5757
android.sh emulator start "$device"
58-
59-
echo "Emulator will remain running after tests complete"
60-
exit 0
6158
fi
59+
# Keep process alive for readiness probe (process-compose services pattern)
60+
tail -f /dev/null
6261
availability:
6362
restart: "no"
6463
readiness_probe:

examples/react-native/tests/test-suite-ios-e2e.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ processes:
5050
# Phase 4: Start simulator
5151
ios-simulator:
5252
command: |
53-
ios.sh simulator start ${IOS_DEVICE}
54-
55-
# In pure mode, keep process alive so cleanup can shut down test simulator
5653
if [ "${IN_NIX_SHELL:-}" = "pure" ] || [ "${DEVBOX_PURE_SHELL:-}" = "1" ]; then
57-
tail -f /dev/null
54+
ios.sh simulator start --pure ${IOS_DEVICE}
55+
else
56+
ios.sh simulator start ${IOS_DEVICE}
5857
fi
58+
# Keep process alive for readiness probe (process-compose services pattern)
59+
tail -f /dev/null
5960
depends_on:
6061
sync-simulators:
6162
condition: process_completed_successfully

plugins/android/virtenv/scripts/user/android.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ set -eu
1313
# ============================================================================
1414
# Initialize Android Environment
1515
# ============================================================================
16-
# SDK setup happens in init hook via setup.sh
16+
# Auto-setup SDK if not already done (e.g., when called from process-compose)
17+
if [ -z "${ANDROID_SDK_ROOT:-}" ] && [ -n "${ANDROID_SCRIPTS_DIR:-}" ]; then
18+
if [ -f "${ANDROID_SCRIPTS_DIR}/init/setup.sh" ]; then
19+
. "${ANDROID_SCRIPTS_DIR}/init/setup.sh"
20+
fi
21+
fi
1722

1823
# ============================================================================
1924
# Usage and Help

0 commit comments

Comments
 (0)