Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Automatically retry failed apk-instrumentation tests. #7963

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Apr 17, 2023

The apk-instrumentation tests are a good candidate for using retryCountOnTaskFailure. This is because they only take a few minutes to run, and have a low enough flaky rate that it is likely that rerunning the entire test suite will succeed.

As noted in dotnet/java-interop#1095, AzDO's support for this isn't perfect. The initial failure will still show up in the Error Log, however the task will be green and will not show up as a failed build.

Ironically, you can see it in action on this build because we have an HTTP test that is currently failing with 504. 🤷‍♂️

@jpobst jpobst marked this pull request as ready for review April 17, 2023 18:19
Copy link
Member

@pjcollins pjcollins left a comment

Choose a reason for hiding this comment

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

@jpobst jpobst merged commit bff7242 into main Apr 17, 2023
@jpobst jpobst deleted the retry-apk-tests branch April 17, 2023 19:29
grendello added a commit to grendello/xamarin-android that referenced this pull request Apr 24, 2023
* main:
  [Xamarin.Android.Build.Tasks] enable ForceInterpretedInvoke switch (dotnet#7972)
  [Mono.Android] Bind API-UpsideDownCake Beta 1 (dotnet#7980)
  Bump to xamarin/xamarin-android-tools/main@8bc07503 (dotnet#7863)
  [automation] Add 'xaSourcePath' to yaml so they can be used from monodroid. (dotnet#7978)
  Bump to dotnet/installer@16c10f8115 8.0.100-preview.4.23218.1 (dotnet#7969)
  [docs] Add UnitTest.md  (dotnet#7877)
  [ci] Suppress fork PR build warnings (dotnet#7973)
  [Xamarin.Android.Build.Tasks] Bump ZipFlushFilesLimit (dotnet#7957)
  Bump to dotnet/installer@3ca7ad1c79 8.0.100-preview.4.23211.1 (dotnet#7946)
  [CI] Allow passing xamarin-android checkout dir to nested templates. (dotnet#7961)
  [Xamarin.Android.Build.Tasks] Fix `-int.ToString()` for locales (dotnet#7941)
  [ci] Automatically retry failed apk-instrumentation tests. (dotnet#7963)
jpobst added a commit that referenced this pull request May 3, 2023
[Previously](#7963), we have used `retryCountOnTaskFailure` to retry some of our flaky test suites.  However this is not a good solution for our MSBuild and emulator tests for 2 reasons:
- Running each suite takes 30-60 minutes, so it would take a long time to retry the entire suite.
- The suites are very flaky, and rerunning the entire suite would likely result in test(s) that were successful on the first run to fail on the second.

We need a solution that only retries the specific test(s) that failed.  Unfortunately nothing like that exists, so we'll once again have to roll our own solution, and we can reuse `dotnet-test-slicer` for this.

This involves some trickery to make everything show up correctly in the AzDO UI:
- Run the initial test suite
  - Run in a Powershell so we can ignore any test failures that would move the pipeline into `SucceededWithIssues` state
  - Do not automatically publish the test results, as they would contain test failures
- Run `dotnet-test-slicer retry`
  - This creates a new `.runsettings` file that only contains the failed tests so `dotnet test` can run only them
  - It also rewrites the test results file of the initial run and removes any failed tests from so it can be published to AzDO
- Publish the successful tests from the first run to AzDO
- Run the retried tests
  - This time we can use normal `dotnet`, and any test failures can be automatically reported to AzDO

Affected Test Suites:
- MSBuild Emulator Tests
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants