-
Notifications
You must be signed in to change notification settings - Fork 98
Explicit forward proxy support for HTTP with Basic Auth #1201
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
base: main
Are you sure you want to change the base?
Conversation
|
||
// Test missing username/password | ||
proxyMissing := &config.Proxy{URL: "http://localhost:8080"} | ||
setProxyWithBasicAuth(ctx, proxyMissing, u) // Should not panic |
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.
Could a check be added to this test to check that we get the log output we expect if its not set ?
setProxyWithBasicAuth(ctx, proxyMissing, u) // Should not panic | |
logBuf := &bytes.Buffer{} | |
stub.StubLoggerWith(logBuf) | |
// Test missing username/password | |
proxyMissing := &config.Proxy{URL: "http://localhost:8080"} | |
setProxyWithBasicAuth(ctx, proxyMissing, u) | |
helpers.ValidateLog(t, "Unable to configure OTLP exporter proxy, "+ | |
"username or password missing for basic auth", logBuf) |
return tlsConf, nil | ||
} | ||
|
||
//nolint:lll //This needs to be in a single line. |
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.
Could you add more detail to the comment about why it needs to be a single line
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.
If I break this line into 2 either I am getting gofumpt error or compiler error.
} | ||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) | ||
defer cancel() | ||
_, _ = DialViaHTTPProxy(ctx, proxyConf, "example.com:443") |
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.
Should the error returned here be checked ?
return false | ||
} | ||
|
||
func TestDialViaHTTPProxy_InvalidCAPath(t *testing.T) { |
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.
Could TestDialViaHTTPProxy_InvalidCAPath
TestDialViaHTTPProxy_MissingCertKey
& TestDialViaHTTPProxy_InvalidProxyURL
be one test with different test parameters in a struct ?
Proposed changes
Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to that issue using one of the supported keywords here in this description (not in the title of the PR).
Checklist
Before creating a PR, run through this checklist and mark each as complete.
CONTRIBUTING
documentmake install-tools
and have attached any dependency changes to this pull requestREADME.md
)