You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
change TestNewAPIClientFromFlagsWithHttpProxyEnv to an e2e test
Golang uses a `sync.Once` when determining the proxy to use. This means
that it's not possible to test the proxy configuration in unit tests,
because the proxy configuration will be "fixated" the first time Golang
detects the proxy configuration.
This patch changes TestNewAPIClientFromFlagsWithHttpProxyEnv to an e2e
test so that we can verify the CLI picks up the proxy configuration.
Signed-off-by: Sebastiaan van Stijn <[email protected]>
// TestTCPSchemeUsesHTTPProxyEnv verifies that the cli uses HTTP_PROXY if
31
+
// DOCKER_HOST is set to use the 'tcp://' scheme.
32
+
//
33
+
// Prior to go1.16, https:// schemes would use HTTPS_PROXY, and any other
34
+
// scheme would use HTTP_PROXY. However, golang/net@7b1cca2 (per a request in
35
+
// golang/go#40909) changed this behavior to only use HTTP_PROXY for http://
36
+
// schemes, no longer using a proxy for any other scheme.
37
+
//
38
+
// Docker uses the tcp:// scheme as a default for API connections, to indicate
39
+
// that the API is not "purely" HTTP. Various parts in the code also *require*
40
+
// this scheme to be used. While we could change the default and allow http(s)
41
+
// schemes to be used, doing so will take time, taking into account that there
42
+
// are many installs in existence that have tcp:// configured as DOCKER_HOST.
43
+
//
44
+
// Note that due to Golang's use of sync.Once for proxy-detection, this test
45
+
// cannot be done as a unit-test, hence it being an e2e test.
0 commit comments