Skip to content

Commit

Permalink
[chore][receiver/apache] Enable goleak check (#32472)
Browse files Browse the repository at this point in the history
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
This enables `goleak` on the Apache receiver to help ensure no
goroutines are leaking. This is a test only change, a test server wasn't
properly being shutdown in a test.

**Link to tracking Issue:** <Issue number if applicable>
#30438

**Testing:** <Describe what testing was performed and which tests were
added.>
All existing tests are passing, as well as added `goleak` checks.
  • Loading branch information
crobert-1 authored Apr 17, 2024
1 parent cf20394 commit 20dc2f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions receiver/apachereceiver/package_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package apachereceiver

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}
2 changes: 2 additions & 0 deletions receiver/apachereceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (

func TestScraper(t *testing.T) {
apacheMock := newMockServer(t)
defer func() { apacheMock.Close() }()

cfg := createDefaultConfig().(*Config)
cfg.Endpoint = fmt.Sprintf("%s%s", apacheMock.URL, "/server-status?auto")
require.NoError(t, component.ValidateConfig(cfg))
Expand Down

0 comments on commit 20dc2f4

Please sign in to comment.