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

confighttp: add component.Host parameter to ToServer #4514

Merged
merged 2 commits into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
s/assert/require/ for some tests, s/how/now/
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
  • Loading branch information
jpkrohling committed Dec 6, 2021
commit 39704701a691888191d053c541adc9e2343b21a2
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

- Remove `config.NewConfigMapFrom[File|Buffer]`, add testonly version (#4502)
- `configtls`: TLS 1.2 is the new default mininum version (#4503)
- `confighttp`: `ToServer` how accepts a `component.Host`, in line with gRPC's counterpart (#4514)
- `confighttp`: `ToServer` now accepts a `component.Host`, in line with gRPC's counterpart (#4514)

## 🧰 Bug fixes 🧰

Expand Down
13 changes: 8 additions & 5 deletions config/confighttp/confighttp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,16 @@ func TestHttpReception(t *testing.T) {
TLSSetting: tt.tlsServerCreds,
}
ln, err := hss.ToListener()
assert.NoError(t, err)
require.NoError(t, err)

s, err := hss.ToServer(
componenttest.NewNopHost(),
componenttest.NewNopTelemetrySettings(),
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, errWrite := fmt.Fprint(w, "test")
assert.NoError(t, errWrite)
}))
assert.NoError(t, err)
require.NoError(t, err)

go func() {
_ = s.Serve(ln)
Expand All @@ -407,7 +408,8 @@ func TestHttpReception(t *testing.T) {
TLSSetting: *tt.tlsClientCreds,
}
client, errClient := hcs.ToClient(map[config.ComponentID]component.Extension{})
assert.NoError(t, errClient)
require.NoError(t, errClient)

resp, errResp := client.Get(hcs.Endpoint)
if tt.hasError {
assert.Error(t, errResp)
Expand Down Expand Up @@ -464,14 +466,15 @@ func TestHttpCors(t *testing.T) {
}

ln, err := hss.ToListener()
assert.NoError(t, err)
require.NoError(t, err)

s, err := hss.ToServer(
componenttest.NewNopHost(),
componenttest.NewNopTelemetrySettings(),
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}))
assert.NoError(t, err)
require.NoError(t, err)

go func() {
_ = s.Serve(ln)
Expand Down