Skip to content

Commit

Permalink
fix: first test with docker image prebuilt
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilb committed May 2, 2024
1 parent 029b2e5 commit 93c7027
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 158 deletions.
10 changes: 7 additions & 3 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
steps: [
{
name: 'appium android tests',
image: "android-emulator",
image: "registry.oxen.rocks/appium-34-pixel6",
environment: {
'APK_TO_TEST_URL': '',
'APK_URL': 'https://oxen.rocks/AL-Session/session-android/dev/session-android-20240402T225341Z-d3c863574-universal.tar.xz',
'APK_TO_TEST_PATH':'/session.apk',
'NODE_CONFIG_ENV': 'ci',
},
commands: [
'cp -r docker/etc/* /etc',
'/usr/bin/supervisord -c /etc/supervisord_test.conf',
'/usr/bin/dl_and_test'
'chmod +x ./docker/*.sh',
'./docker/start_emulators.sh',
'./docker/dl.sh',
'yarn install --immutable && yarn tsc && yarn test-no-retry ""'

],

Expand Down
1 change: 0 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
nodeLinker: node-modules
# enableImmutableInstalls: true # should be forced on CI only
23 changes: 0 additions & 23 deletions Dockerfile

This file was deleted.

119 changes: 0 additions & 119 deletions Dockerfile.base

This file was deleted.

3 changes: 3 additions & 0 deletions docker/dl.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

set -ex

echo "APK_URL: $APK_URL"
apk_url=${APK_URL}
apk_saved_on=${APK_TO_TEST_PATH}

Expand Down
3 changes: 0 additions & 3 deletions docker/dl_and_test.sh

This file was deleted.

3 changes: 0 additions & 3 deletions docker/etc/supervisor/conf.d/start_emulators.conf

This file was deleted.

2 changes: 1 addition & 1 deletion docker/etc/supervisord_test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ loglevel = info


[include]
files = /etc/supervisor/conf.d/fluxbox.conf /etc/supervisor/conf.d/start_emulators.conf /etc/supervisor/conf.d/websockify.conf /etc/supervisor/conf.d/x11vnc.conf /etc/supervisor/conf.d/xfvb.conf /etc/supervisor/conf.d/xterm.conf
files = /etc/supervisor/conf.d/fluxbox.conf /etc/supervisor/conf.d/websockify.conf /etc/supervisor/conf.d/x11vnc.conf /etc/supervisor/conf.d/xfvb.conf /etc/supervisor/conf.d/xterm.conf
4 changes: 2 additions & 2 deletions docker/start_emu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NC='\033[0m' # No Color
emulator_name=${EMULATOR_NAME}
device_name=${DEVICE_NAME}

function wait_emulator_to_be_ready() {
function start_emulator() {
emulator -avd "${emulator_name}" -gpu off -read-only
printf "${G}==> ${BL}Emulator has ${YE}${EMULATOR_NAME} ${BL}started in headed mode! ${G}<==${NC}""\n"
}
Expand All @@ -21,6 +21,6 @@ function disable_animation() {
adb -s ${device_name} shell "settings put global animator_duration_scale 0.0"
}

wait_emulator_to_be_ready
start_emulator
sleep 1
disable_animation
58 changes: 58 additions & 0 deletions docker/start_emulators.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -ex

DIR="$(cd "$(dirname "$0")" && pwd)"

start_emu=$DIR/start_emu.sh

adb devices

function wait_emulator_to_be_ready() {
to_wait_for="${1}"
start_time=$(date +%s)
timeout=200
sleep_interval=1
printf "==> Waiting booted emulator ... \n"

while [ "`adb -s ${to_wait_for} shell getprop sys.boot_completed | tr -d '\r' `" != "1" ] ; do
adb devices
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ $elapsed_time -gt $timeout ]; then
printf "==> Timeout after ${timeout} seconds elapsed .. \n"
break
fi
printf "==> Emulator not reported as booted yet ... sleeping ${sleep_interval} before retry\n"
sleep $sleep_interval;
done

if [ "`adb -s ${to_wait_for} shell getprop sys.boot_completed | tr -d '\r' `" == "1" ] ; then
printf "==> Emulator is booted! \n"
fi
}

export EMULATOR_NAME="emulator1" # they all share the same avd, but started with the -read-only flag to make it work
DEVICE_NAME="emulator-5554" $start_emu &
sleep 1
DEVICE_NAME="emulator-5556" $start_emu &
sleep 1
DEVICE_NAME="emulator-5558" $start_emu &
sleep 1
DEVICE_NAME="emulator-5560" $start_emu &
sleep 1

sleep 30;
adb devices;sleep 30;
adb devices;sleep 30;
adb devices;sleep 30;
adb devices;sleep 30;
adb devices;sleep 30;
adb devices;sleep 30;
adb devices;
# wait_emulator_to_be_ready "emulator-5554"
# wait_emulator_to_be_ready "emulator-5556"
# wait_emulator_to_be_ready "emulator-5558"
# wait_emulator_to_be_ready "emulator-5560"

# wait # hang in here while the emulators are running
3 changes: 0 additions & 3 deletions docker/test.sh

This file was deleted.

0 comments on commit 93c7027

Please sign in to comment.