Skip to content

Add a separate test pass to run flaky tests that doesn't fail the build #8486

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

Merged
merged 11 commits into from
Mar 19, 2019

Conversation

analogrelay
Copy link
Contributor

@analogrelay analogrelay commented Mar 13, 2019

Similar to dotnet/extensions#1239.

This doesn't actually add the pass yet, just a sample flaky test to use to verify things are working. Sorry Kestrel CODEOWNERS, you're getting pinged on this one because you're the random victim ;). I'll remove reviewers and re-add ones that make sense when this is ready to review.

TODO:

  • It worked on Windows, make sure it works on macOS and Ubuntu too
  • Make sure TRX files are still published.

jkotalik
jkotalik previously approved these changes Mar 13, 2019
Copy link
Contributor

@jkotalik jkotalik left a comment

Choose a reason for hiding this comment

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

Seems great! 😄

@@ -1,3 +1,6 @@
REM Disable "!Foo!" expansions because they break the filter syntax
setlocal disableextensions
Copy link
Contributor Author

Choose a reason for hiding this comment

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

cc @HaoK

Even with the planned change to ignore the exit code from helix altogether I'd like to get this change in in some form so that when we do start paying attention to the exit code, we don't start getting known-flaky tests causing failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Still working on Unix scripts btw)

Copy link
Member

Choose a reason for hiding this comment

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

Yup, ignoring the exit code is hopefully just a short/medium term thing that gives us some time to get flaky in place

Copy link
Member

Choose a reason for hiding this comment

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

maybe consider passing in the filters to each script (assuming they are the same in the sh version)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, they would be the same. I'll look at that. There can be some shell escaping problems with the syntax so it might be tricky, but I'll give it a shot.

@Eilon Eilon added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Mar 13, 2019
@HaoK
Copy link
Member

HaoK commented Mar 13, 2019

Do you think its worth separating flaky and non flaky farther apart for helix? Basically instead of running both flaky and non flaky on the same helix item (and just ignoring flaky failures), build two helix work items instead of one per test project, only including the additional run helix flaky work item if the test project has any marked (and the script could just take an parameter saying to always report success for that run).

For example:
20190313.11/workItem/ProjectTemplates.Tests-netcoreapp3.0 excluding flaky tests
20190313.11/workItem/ProjectTemplates.Tests-netcoreapp3.0-flaky with the flaky tests filter and alwaysSucceed = true (if we can't detect this at build time, can just add a FlakyTests=true msbuild property for those test projects)

@analogrelay
Copy link
Contributor Author

We could do that, but adding a FlakyTest msbuild property seems error-prone. One of the things I like about the current system is that you just slap an attribute on a test and get the behavior, you don't have to remember to update an MSBuild file.

@analogrelay
Copy link
Contributor Author

🤞 I think I have the YAML and MSBuild goop in place to run the Flaky test pass separately.

@analogrelay
Copy link
Contributor Author

Helix results look good (https://mc.dot.net/#/user/aspnetcore/pr~2Faspnet~2Faspnetcore/ci/20190314.26/workItem/Libuv.FunctionalTests-netcoreapp3.0/wilogs). Helix is reporting success even though flaky tests failed.

@analogrelay analogrelay marked this pull request as ready for review March 15, 2019 17:25
@analogrelay
Copy link
Contributor Author

I believe this is basically ready for review. I will remove the fake-flaky test I added to Kestrel before merging (feel free to withhold final approval until I do that if you'd like) but the rest should be ready to review.

Copy link
Contributor

@dougbu dougbu left a comment

Choose a reason for hiding this comment

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

Minor comments and, yes, remove the temporary test 😺

$DOTNET_ROOT/dotnet vstest $1 --logger:trx
# Run non-flaky tests first
# We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute
# only puts the explicit filter traits the user provided in
Copy link
Contributor

Choose a reason for hiding this comment

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

"provided in" what?

%DOTNET_ROOT%\dotnet vstest %target% --logger:trx --logger:console;verbosity=normal --TestCaseFilter:%FLAKY_FILTER%
if errorlevel 1 (
echo Failure in flaky test 1>&2
REM DO NOT EXIT and DO NOT SET EXIT_CODE to 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest including similar comments in runtests.sh


REM Run non-flaky tests first
REM We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute
REM only puts the explicit filter traits the user provided in
Copy link
Contributor

Choose a reason for hiding this comment

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

"provided in" what?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shhhhhh

Copy link
Member

@HaoK HaoK left a comment

Choose a reason for hiding this comment

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

Looks good,

one thing that still nags me is running the non flaky + flaky tests together on helix. There's going to be potentially a lot more noise in the helix logs with all the flaky tests at the end so its going to make it even more painful hunting for the non flaky error messages (compared to a clean helix job with its on mission control link + a flaky helix job with a perma red mission control link)

But hopefully once we get trx support for the error reporting maybe it won't be as much of an issue

@HaoK
Copy link
Member

HaoK commented Mar 15, 2019

Basically an alternative to consider doing eventually is two helix jobs

  1. helix job with FailOnMissionControlFailure = true (non flaky version),
  2. helix job that passes in the flaky filter to run all tests that runs with FailOnMissionControl = false (so the build ignores any failures from that run)

@analogrelay
Copy link
Contributor Author

Yeah, I do agree that it won't be the cleanest results format. I could suppress the console output of the flaky run maybe.

We could create separate Helix work items for flaky tests if we thought that was useful but it feels like that will take up a lot more resources than it's worth...

@HaoK
Copy link
Member

HaoK commented Mar 15, 2019

Well its not a big deal right now since we are treating all helix tests as flaky so...there's that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants