dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.25k stars 4.73k forks source link

System.Net.Tests.HttpWebRequestTest.KeepAlive_CorrectConnectionHeaderSent #25611

Closed sdmaclea closed 4 years ago

sdmaclea commented 6 years ago

Looks like should be marked Conditional on LocalServerAvailable

xUnit.net console test runner (64-bit .NET Core)
Copyright (C) 2014 Outercurve Foundation.

Discovering: System.Net.Requests.Tests
Discovered:  System.Net.Requests.Tests
Starting:    System.Net.Requests.Tests
   System.Net.Tests.FtpWebRequestTest.Ftp_RenameFileSubDir_Success [SKIP]
      Condition(s) not met: \"LocalServerAvailable\"
   System.Net.Tests.FtpWebRequestTest.Ftp_LargeFile [SKIP]
      Condition(s) not met: \"LocalServerAvailable\"
   System.Net.Tests.FtpWebRequestTest.Ftp_CreateAndDelete [SKIP]
      Condition(s) not met: \"LocalServerAvailable\"
   System.Net.Tests.FtpWebRequestTest.Ftp_RenameFile [SKIP]
      Condition(s) not met: \"LocalServerAvailable\"
   System.Net.Tests.FtpWebRequestTest.Ftp_MakeAndRemoveDir_Success [SKIP]
      Condition(s) not met: \"LocalServerAvailable\"
   System.Net.Tests.FtpWebRequestTest.Ftp_AppendFile [SKIP]
      Condition(s) not met: \"LocalServerAvailable\"
   System.Net.Tests.HttpWebRequestTest.KeepAlive_CorrectConnectionHeaderSent(keepAlive: False) [FAIL]
      Assert.Contains() Failure
      Not found: "Connection": "close"
      In value:  {"Method":"GET","Url":"/Echo.ashx","Headers": {
          "Connection": "Keep-Alive",
          "Via": "1.1 10.38.1.212 (McAfee Web Gateway 7.6.2.8.0.22994)",
          "Host": "corefx-net.cloudapp.net",
          "X-Forwarded-For": "10.228.198.226"
        },
        "Cookies": {},
        "BodyContent": "",
        "BodyLength": 0,
        "SecureConnection": false,
        "ClientCertificatePresent": false,
        "ClientCertificate": null
      }
      Stack Trace:
         /home/vmjenkins/workspace/Dotnet/build_corefx/src/System.Net.Requests/tests/HttpWebRequestTest.cs(457,0): at System.Net.Tests.HttpWebRequestTest.KeepAlive_CorrectConnectionHeaderSent(Nullable`1 keepAlive)
Finished:    System.Net.Requests.Tests
sdmaclea commented 6 years ago

Removed [Arm64] Because I think this is a testbug.

davidsh commented 6 years ago

This is a test bug. The test should only be testing what the client sent to an endpoint. But it currently does this via sending a request to the echo server which echoes back the request headers.

However, this test seems to be running through a proxy server. The "Via:" header sent in the request proves that.

"Via": "1.1 10.38.1.212 (McAfee Web Gateway 7.6.2.8.0.22994)"

And the proxy server is changing the request headers before they reach the final endpoint, in this case, corefx-net.cloudapp.net.

So, this test should be changed to use the loopback test server which will avoid using a proxy server. And then the test can simply test what the loopback server receives.

sdmaclea commented 6 years ago

This was run inside QDT firewall. That is probably the proxy you are seeing.

sdmaclea commented 6 years ago

@jkotas