zebrunner / mcloud-grid

Customized selenium-hub
6 stars 3 forks source link

Can't use device from grid without STF-agent connected #149

Open azarouski opened 4 months ago

azarouski commented 4 months ago

I have following workaround:

  1. Device connected to server
  2. Appium instance connected to device and successfully registered in mcloud/grid/console
  3. No mcloud-device container started
docker run -itd --name device-Samsung_Galaxy_S7-123123123123-appium -m 1g --log-opt max-size=1024m --log-opt max-file=2 --net=infra \
--restart on-failure \
--link device-Samsung_Galaxy_S7-123123123123-connector:connector \
-v appium-storage-volume:/opt/appium-storage \
-v device-Samsung_Galaxy_S7-123123123123:/tmp/log \
-e TASK_LOG=/tmp/log/appium.log \
-e PLATFORM_NAME=android \
-e ANDROID_DEVICE=$ANDROID_DEVICE \
-e RETAIN_TASK=true \
-e CONNECT_TO_GRID=true \
-e CUSTOM_NODE_CONFIG=true \
-e STF_PROVIDER_HOST=demo.zebrunner.farm \
-e APPIUM_APP_SIZE_DISABLE=false \
-e APPIUM_APP_FETCH_RETRIES=2 \
-e APPIUM_MAX_LOCK_FILE_LIFETIME=180 \
-e APPIUM_APP_WAITING_TIMEOUT=90 \
-e SELENIUM_HOST=mcloud-grid \
-e SELENIUM_PORT=4444 \
-e DEFAULT_CAPABILITIES=true \
-e DEVICE_NAME=Samsung_Galaxy_S7 \
-e DEVICE_UDID=123123123123 \
-e ADB_PORT=7552 \
-e PROXY_PORT=7553 \
-e SERVER_PROXY_PORT=0 \
-e APPIUM_PORT=7551 \
-p 7551:7551 \
-e RELAXED_SECURITY=true \
-e LOG_LEVEL=debug \
-e ADB_SERVER_SOCKET=tcp:connector:5037 \
-e REMOTE_ADB_HOST_1=connector \
public.ecr.aws/zebrunner/appium:connector

When i'm trying to run tests on this device i have following error logs in mcloud-grid:2.5 container

[STFClient.reserveSTFDevice] - [STF-02549a97-e365-414a-82f8-7ada04592a68] Could not reserve STF device with udid: 123123123123. Status: 0. Response: null
[STFClient.reserveSTFDevice] - [STF-02549a97-e365-414a-82f8-7ada04592a68] Device will be marked as unhealthy due to response status '0'.
[STFClient.reserveSTFDevice] - [STF-02549a97-e365-414a-82f8-7ada04592a68] Could not mark device as unhealthy. Status: 403. Response: null

[TestSlot.getNewSession] - Trying to create a new session on test slot {deviceType=Phone, proxy_port=7553, server:CONFIG_UUID=de0ee23d-545a-4ee2-864f-86a886468ef7, seleniumProtocol=WebDriver, server_proxy_port=0, adb_port=7552, deviceName=Samsung_Galaxy_S7, platform=ANDROID, platformVersion=8.0.0, automationName=uiautomator2, maxInstances=1, platformName=android, udid=123123123123}

these logs are produced by the following code https://github.com/zebrunner/mcloud-grid/blob/3d3d6e183c3dfc081e49192869129fca264b4133/src/main/java/com/zebrunner/mcloud/grid/integration/client/STFClient.java#L153-L180


When i'm starting mcloud-device(STF) container everything works fine.


Let's discuss how to fix this problem and should we fix it.