Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[video_player] Fix a flaky test #4611

Merged

Conversation

stuartmorgan-g
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g commented Dec 13, 2021

The 'reports buffering status' test was written in an unnecessary complicated way that used pairs of completers and booleans that tracked the same thing, and more importantly had a bug (hidden by the fact that this package is still on legacy analysis options) where the await statements weren't actually doing anything, because they were not actually awaiting futures.

This fixes the lack of awaits—which should fix the flake—and removes the unnecessary booleans.

Fixes flutter/flutter#94775

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

This test is flaking in a way that doesn't seem like it should be
possible, since the bool whose value is incorrect is only set in one
place, and its the same place where the future being awaited just before
is completed.

While the cause of the flake isn't understood, it's odd to have
duplicate ways of expressing the same thing in the test in the first
place, so this removes the booleans entirely and uses the completers
directly. This may or may not fix the flake (since we don't
understand how it's possible to flake), but it simplifies the test, and
if it still fails we may get a less confusing failure mode.

Part of flutter/flutter#94775
Copy link
Member

@ditman ditman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on Discord. LGTM!

@stuartmorgan-g stuartmorgan-g changed the title [video_player] Adjust a flaky test [video_player] Fix a flaky test Dec 13, 2021
@stuartmorgan-g stuartmorgan-g merged commit bfa3438 into flutter:master Dec 13, 2021
@stuartmorgan-g stuartmorgan-g deleted the video-test-buffer-simplification branch December 13, 2021 22:20
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 13, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 20, 2021
KyleFin pushed a commit to KyleFin/plugins that referenced this pull request Dec 21, 2021
The 'reports buffering status' test was written in an unnecessary complicated way that used pairs of completers and booleans that tracked the same thing, and more importantly had a bug (hidden by the fact that this package is still on legacy analysis options) where the `await` statements weren't actually doing anything, because they were not actually `await`ing futures.

This fixes the lack of awaits—which should fix the flake—and removes the unnecessary booleans.

Fixes flutter/flutter#94775
stuartmorgan-g added a commit to stuartmorgan-g/plugins that referenced this pull request Feb 10, 2022
Switches from legacy analysis options to current analysis options,
fixing all analysis issues it exposed.

Also fixes a flaky test; the strict options highlighted that another
test was still using the same broken pattern that was found and fixed
in flutter#4611

Part of flutter/flutter#76229
stuartmorgan-g added a commit to stuartmorgan-g/plugins that referenced this pull request Feb 10, 2022
Switches from legacy analysis options to current analysis options,
fixing all analysis issues it exposed.

Also fixes a flaky test; the strict options highlighted that another
test was still using the same broken pattern that was found and fixed
in flutter#4611

Part of flutter/flutter#76229
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[video_player] Integration test flake on Android
2 participants