This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Skipping Admin-only tests instead of failing them #766
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
agr
requested review from
joelverhagen,
loic-sharma,
xavierdecoster,
shishirx34,
ryuyu,
cristinamanum,
skofman1,
dannyjdev,
scottbommarito,
zhhyu and
mogah
June 13, 2019 23:05
loic-sharma
reviewed
Jun 14, 2019
loic-sharma
approved these changes
Jun 14, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome idea 👍
agr
commented
Jun 14, 2019
{ | ||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | ||
[XunitTestCaseDiscoverer("Xunit.Sdk.FactDiscoverer", "xunit.execution.{Platform}")] | ||
public class FactIfAdminAttribute : FactAttribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any name suggestions? AdminOnlyFact
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like AdminOnly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have theories, too, also AdminOnly
does not emphasize that it's a test.
…MIN_TEST_SKIP` environment variable so that there would be no way to skip those in CI by accident.
joelverhagen
approved these changes
Jun 14, 2019
joelverhagen
pushed a commit
that referenced
this pull request
Jul 31, 2020
The `auxiliary2azuresearch` job needs to know which popularity transfers have changed to properly update the search index. Previous change: NuGet/NuGet.Services.Metadata#765 Part of NuGet/NuGetGallery#7898
joelverhagen
pushed a commit
that referenced
this pull request
Oct 26, 2020
* Skipping admin-only tests when run as non-admin gracefully instead of failing them. * Made non-admin test skip conditional on the presence of `ENABLE_NONADMIN_TEST_SKIP` environment variable so that there would be no way to skip those in CI by accident.
joelverhagen
pushed a commit
that referenced
this pull request
Oct 26, 2020
The `auxiliary2azuresearch` job needs to know which popularity transfers have changed to properly update the search index. Previous change: NuGet/NuGet.Services.Metadata#765 Part of NuGet/NuGetGallery#7898
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Got fed up with all the redness in test explorer. This introduces two additional test attributes that will automagically skip if tests are executed not as admin. Since there were two test assemblies with admin-only tests, had to introduce shared test library with common code.
Tested in VS: when run as regular user, skips all tests that failed before, when run as admin runs them fine. Tested that CI still runs those tests after the change.
To enable test skip one needs to add the
ENABLE_NONADMIN_TEST_SKIP
environment variable. This was done to reduce the chance of accidentally skipping those tests in CI (in initial implementation they would be skipped if CI started to run tests as non-admin).