Skip to content

Commit

Permalink
[test] remove cleanup statements
Browse files Browse the repository at this point in the history
These statements seem to be a workaround for the server not being closed correctly, with the previous changes this should no longer be necessary
  • Loading branch information
Soeren-S committed Oct 14, 2024
1 parent c59034c commit 381f74f
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions exporter/prometheusexporter/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ func TestPrometheusExporter_WithTLS(t *testing.T) {

t.Cleanup(func() {
require.NoError(t, exp.Shutdown(context.Background()))
// trigger a get so that the server cleans up our keepalive socket
var resp *http.Response
resp, err = httpClient.Get("https://localhost:7777/metrics")
require.NoError(t, err)
require.NoError(t, resp.Body.Close())
})

assert.NotNil(t, exp)
Expand Down Expand Up @@ -196,11 +191,6 @@ func TestPrometheusExporter_endToEndMultipleTargets(t *testing.T) {

t.Cleanup(func() {
require.NoError(t, exp.Shutdown(context.Background()))
// trigger a get so that the server cleans up our keepalive socket
var resp *http.Response
resp, err = http.Get("http://localhost:7777/metrics")
require.NoError(t, err)
require.NoError(t, resp.Body.Close())
})

assert.NotNil(t, exp)
Expand Down Expand Up @@ -280,11 +270,6 @@ func TestPrometheusExporter_endToEnd(t *testing.T) {

t.Cleanup(func() {
require.NoError(t, exp.Shutdown(context.Background()))
// trigger a get so that the server cleans up our keepalive socket
var resp *http.Response
resp, err = http.Get("http://localhost:7777/metrics")
require.NoError(t, err)
require.NoError(t, resp.Body.Close())
})

assert.NotNil(t, exp)
Expand Down Expand Up @@ -359,11 +344,6 @@ func TestPrometheusExporter_endToEndWithTimestamps(t *testing.T) {

t.Cleanup(func() {
require.NoError(t, exp.Shutdown(context.Background()))
// trigger a get so that the server cleans up our keepalive socket
var resp *http.Response
resp, err = http.Get("http://localhost:7777/metrics")
require.NoError(t, err)
require.NoError(t, resp.Body.Close())
})

assert.NotNil(t, exp)
Expand Down Expand Up @@ -441,11 +421,6 @@ func TestPrometheusExporter_endToEndWithResource(t *testing.T) {

t.Cleanup(func() {
require.NoError(t, exp.Shutdown(context.Background()))
// trigger a get so that the server cleans up our keepalive socket
var resp *http.Response
resp, err = http.Get("http://localhost:7777/metrics")
require.NoError(t, err, "Failed to perform a scrape")
require.NoError(t, resp.Body.Close())
})

assert.NotNil(t, exp)
Expand Down

0 comments on commit 381f74f

Please sign in to comment.