Skip to content

Integration test TimeoutException after 0:12:00.000000: Test timed out after 12 minutes #105913

@nilsreichardt

Description

@nilsreichardt

Description

I have the exact same issue as @ductranit in #103064. I'm getting

12:00 +0 -1: loading /Users/runner/work/sharezone-app/sharezone-app/app/integration_test/app_test.dart [E]                                                                                             
  TimeoutException after 0:12:00.000000: Test timed out after 12 minutes.
  package:test_api/src/backend/invoker.dart 333:28  Invoker._handleError.<fn>
  dart:async/zone.dart 1418:47                      _rootRun
  dart:async/zone.dart 1328:19                      _CustomZone.run
  package:test_api/src/backend/invoker.dart 331:10  Invoker._handleError
  package:test_api/src/backend/invoker.dart 287:9   Invoker.heartbeat.<fn>.<fn>
  dart:async/zone.dart 1426:13                      _rootRun
  dart:async/zone.dart 1328:19                      _CustomZone.run
  package:test_api/src/backend/invoker.dart 286:38  Invoker.heartbeat.<fn>
  dart:async-patch/timer_patch.dart 18:15           Timer._createTimer.<fn>
  dart:isolate-patch/timer_impl.dart 395:19         _Timer._runTimers
  dart:isolate-patch/timer_impl.dart 426:5          _Timer._handleMessage
  dart:isolate-patch/isolate_patch.dart 192:12      _RawReceivePortImpl._handleMessage

https://github.com/SharezoneApp/sharezone-app/runs/6866573231?check_suite_focus=true

I'm using the flutter test command. Building my app takes ~20 minutes. But the flutter test command times out after 12 minutes. So even before finish building my app, the command times out.

Using the timeout argument (flutter test --timeout none) changes nothing.

Workaround

1) Use flutter drive

My workaround is to use the flutter drive command:

flutter drive \
  --driver=test_driver/integration_test.dart \
  --target=integration_test/app_test.dart

The flutter drive command has no timeout. Therefore, the app finishes after ~20 minutes of building and all tests can pass.

Using v2.10.5 of Flutter.

2) Use flutter build and then flutter test

Another workaround is to run flutter build before running flutter test. Therefore, the build for flutter test should hopefully be faster because of the caching.


Edit: I have reproducible repository. It uses Flutter v3.3.4 and has cloud_firestore as a dependency to increase the build duration: https://github.com/nilsreichardt/playground/tree/integration-test-timeout

Running flutter test integration_test --timeout none on a slow machine (like CI) will fail after 12 minutes: https://github.com/nilsreichardt/playground/actions/runs/3218752730

flutter test integration_test --timeout none: https://github.com/nilsreichardt/playground/actions/runs/3218752730
flutter test integration_test --timeout 3600s: https://github.com/nilsreichardt/playground/actions/runs/3218848669
Use timeout parameter the testWidgets method: https://github.com/nilsreichardt/playground/actions/runs/3218841600
Use @Timeout(Duration(hours: 1)): https://github.com/nilsreichardt/playground/actions/runs/3218844853

Steps to reproduce (we are using Firestore to increase the build duration):

  1. Run these commands
flutter create integration_test_timeout
cd integration_test_timeout
flutter pub add cloud_firestore
flutter pub add firebase_core
  1. Adjust minimum os version, for macOS: Set platform :osx, '10.12' in macos/Podfile
  2. Add a basic integration

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: tests"flutter test", flutter_test, or one of our testscustomer: crowdAffects or could affect many people, though not necessarily a specific customer.team-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool team

    Type

    No type

    Projects

    Status

    Planned Q3

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions