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

convert test to not require the network #10355

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

brettfo
Copy link
Contributor

@brettfo brettfo commented Aug 2, 2024

When #9694 was created to force unit tests to not hit the network, there was one case where we didn't yet have the test infrastructure, because one particular test requires network access, but now we have the appropriate test helpers to hit localhost. This PR simply converts this remaining test from using real packages from nuget.org to using test-only packages and a localhost NuGet feed.

I've manually confirmed that we hit the same codepath.

@brettfo brettfo added the L: dotnet:nuget NuGet packages via nuget or dotnet label Aug 2, 2024
@brettfo brettfo requested a review from a team as a code owner August 2, 2024 19:32
{
"catalogEntry": {
"id": "Delisted.Package",
"listed": false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line is what requires this to be a network test; there's no way to fake this with a local packge feed.

@brettfo brettfo force-pushed the dev/brettfo/nuget-test-no-network branch 2 times, most recently from ec09760 to 363dfd5 Compare August 2, 2024 23:07
@brettfo brettfo force-pushed the dev/brettfo/nuget-test-no-network branch from 363dfd5 to 825fbb0 Compare August 2, 2024 23:22
@@ -0,0 +1,23 @@
namespace NuGetUpdater.Core.Test;

public class TemporaryEnvironment : IDisposable
Copy link
Contributor

Choose a reason for hiding this comment

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

This is such a useful pattern! I can't believe I've never seen it before.

@abdulapopoola abdulapopoola merged commit c95a0fc into main Aug 2, 2024
86 checks passed
@abdulapopoola abdulapopoola deleted the dev/brettfo/nuget-test-no-network branch August 2, 2024 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants