NuGet / Home

Repo for NuGet Client issues
Other
1.49k stars 250 forks source link

Tests should avoid real HTTP URLs #10393

Open rrelyea opened 3 years ago

rrelyea commented 3 years ago

image.png

image

image

image

aortiz-msft commented 3 years ago

@zivkan @sbanni - Given our stance today, do we still need to do work here?

zivkan commented 3 years ago

My PR comments were basically "don't write tests that use real URLs/HTTP requests". When dotnet.myget.org was decomissioned, we had tests break (I don't know if it was these tests, or different ones), which broke our builds and our ability to merge PRs, until we fixed it. In the last 2 weeks, we've had a test that makes requests to nuget.smbsrc.net (unrelated to codespaces) occasionally timeout, again breaking our builds.

So, on one hand yes, I still believe that we should change tests that make real HTTP requests to use mocked HTTP tests (or a fake HTTP source running on localhost). On the other hand, we can deal with these types or errors and flakiness when it causes problems, rather than being proactive about it.

But I still wish people would stop writing/copying tests that make real HTTP requests to remote servers.

nkolev92 commented 2 years ago

Is this relevant?

zivkan commented 2 years ago

Unless you have information otherwise, I believe my comments in https://github.com/NuGet/Home/issues/10393#issuecomment-818396901 stands.