[DDMLIB]: An unexpected packet was received before the handshake.
Steps to reproduce
- Clone [email protected]:leancodepl/patrol.git
- Make new project out of example
- Verify that the app builds fine 'flutter build apk --debug
- Run the integration test: 'patrol test --target integration_test/main_test.dart'
- Move the new project to gitlab repo
- Make a CI pipeline for the patrol test:
.gitlab-ci.yml
integration-android:
image: ghcr.io/cirruslabs/flutter:3.19.1
variables:
apiLevel: "24"
target: "google_apis"
arch: "x86"
deviceName: "nexus_s"
deviceType: "Nexus S"
FLAVOR: "dev"
before_script:
- export PATH="$PATH:$HOME/.pub-cache/bin"
script:
# Set up the emulator
- sdkmanager "platform-tools" "platforms;android-${apiLevel}" "emulator"
- sdkmanager --install "system-images;android-${apiLevel};${target};${arch}"
- sdkmanager --update
- echo "y" | sdkmanager --licenses
- sdkmanager --list_installed
- echo "no" | avdmanager -v create avd --force --name "${deviceName}" --package "system-images;android-${apiLevel};${target};${arch}" --tag "${target}" --sdcard 128M --device "${deviceType}"
# Check Dart & Flutter
- dart --version
- flutter doctor -v
# Install Patrol CLI
- dart pub global activate patrol_cli
# Start up the emulator
- emulator -avd "${deviceName}" -no-audio -no-window -no-snapstorage -no-snapshot -gpu swiftshader_indirect -no-boot-anim -no-accel -wipe-data -skip-adb-auth &
- adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82'
# Run tests with Patrol
# This '--config-only' build is needed to create ./gradlew
# https://github.com/leancodepl/patrol/issues/1301
- flutter build apk --config-only
- patrol test --target integration_test/main_test.dart --flavor ${FLAVOR} --verbose
- mkdir .public
- cp /builds/username/patrol-example/build/app/reports/androidTests/connected/debug/flavors/dev/index.html .public/index.html
- mv .public public
artifacts:
paths:
- public
only:
- main
Actual results
Pipeline job finish with the Gradle build exception:
[DDMLIB]: An unexpected packet was received before the handshake.
[DDMLIB]: An unexpected packet was received before the handshake.
[DDMLIB]: An unexpected packet was received before the handshake.
[DDMLIB]: An unexpected packet was received before the handshake.
:
: > Task :app:connectedDevDebugAndroidTest
Exception thrown during onBeforeAll invocation of plugin com.android.tools.utp.plugins.host.apkinstaller.AndroidTestApkInstallerPlugin.
Failed to install APK: [/builds/username/patrol-example/build/app/outputs/apk/dev/debug/app-dev-debug.apk] on device emulator-5554.
com.google.testing.platform.core.error.UtpException: ErrorName: Test APK installation Error
NameSpace: AndroidTestApkInstallerPlugin
ErrorCode: 2002
ErrorType: TEST
Message: Failed to install APK: [/builds/username/patrol-example/build/app/outputs/apk/dev/debug/app-dev-debug.apk] on device emulator-5554.
Logs
Gradle build logs: https://pastebin.com/4HFtYqL3
Patrol version
patrol: ^3.5.2 patrol_cli: 2.6.4
Patrol Doctor output
Patrol Doctor output
none
Flutter Doctor output
Flutter Doctor output
none
Looks similar with #2071
@nullskill I also saw this message in my gitlab pipeline. Also facing an issue where the tests despite all passing don't return success to the gitlab runner. It keeps hanging until the 1h timeout kills it. Have you faced this issue?
Btw, what are you using for the runner? I used waydroid on a digital ocean droplet. Managed to get it running without a GPU 8cores 16Gb. Most of the time is stable except this dreadful hanging behaviour. So far could not identify a cause. I'm trying to go trough the code to figure out what could it be. Running in verbose mode does not give any extra hint.
@adrian-moisa Sorry, I've already dropped the idea of running Patrol tests in the GitLab pipeline. Just moved to Codemagic and Firebase Test Lab.