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

Add flaky test attribute #8811

Merged
merged 3 commits into from
Jun 7, 2023
Merged

Conversation

ryzngard
Copy link
Contributor

@ryzngard ryzngard commented Jun 6, 2023

Add an attribute that will run tests if the RAZOR_RUN_FLAKY_TESTS is set, otherwise they will be skipped.

@ryzngard ryzngard requested a review from a team as a code owner June 6, 2023 23:32
@ryzngard
Copy link
Contributor Author

ryzngard commented Jun 6, 2023

Test pipeline run

Copy link
Contributor

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

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

I love the idea, but I'm not sure on the terminology. "Flaky" feels too much like an acceptance of guilt 😛

Can we use "RAZOR_RUN_ALL_TESTS"? or "RAZOR_RUN_SKIPPED_TESTS" and call the attribute "ConditionalSkip" or something? Actually, isn't there a [ConditionalFact] in xunit? I'm sure I've seen it somewhere

@@ -12,5 +12,6 @@
"[json]": {
"editor.tabSize": 2
},
"dotnet.defaultSolution": "Razor.sln",
Copy link
Contributor

Choose a reason for hiding this comment

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

lol, finally!

Comment on lines 32 to 33
- name: RAZOR_RUN_FLAKY_TESTS
value: 'true'
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought you were talking about having a separate pipeline to run all tests? Seems like we're just guaranteeing failures if we turn this on here, which means guaranteeding people will have to investigate them, but we already have issues for these.

I would expect either a different pipeline for all tests, so we can compare the two, or use the FlakyFact attribute only on tests that we know for sure will at least pass some % of the time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open for either.

I would expect either a different pipeline for all tests, so we can compare the two, or use the FlakyFact attribute only on tests that we know for sure will at least pass some % of the time.

This was my initial thought. Running the test pipeline and having failure rates generated is worth it. If we want a separate pipeline that's fine too, but I don't much see the point. I figure Conditional Skip = may be enabled at some point. It's the difference between "might work" and "definitely won't work". 0% success rate should just be disabled or fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess I agree with you, I'm just not confident that our existing skipped tests are all there because of flakiness, and not some other issue. We'll find out! 😀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, we're off to a good start!

image

@ryzngard
Copy link
Contributor Author

ryzngard commented Jun 7, 2023

Actually, isn't there a [ConditionalFact] in xunit? I'm sure I've seen it somewhere

Hmm... maybe you're thinking of https://sourceroslyn.io/#Microsoft.CodeAnalysis.Test.Utilities/Assert/ConditionalFactAttribute.cs,aec721ce5b3203aa ?

We definitely could just do the same thing

@davidwengier
Copy link
Contributor

maybe you're thinking of

Probably where I saw it, but probably overkill to use here.

@ryzngard ryzngard merged commit 44a659c into dotnet:main Jun 7, 2023
@ryzngard ryzngard deleted the flaky_tests_attribute branch October 15, 2024 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants