Skip to content

Commit

Permalink
[chore][receiver/gitproviderreceiver] Enable goleak check in GitHub s…
Browse files Browse the repository at this point in the history
…craper (#32362)

**Description:** 
Enable `goleak` check in the `internal/scraper/githubscraper` package of
the Git Provider receiver to help ensure no goroutines are being leaked.
This is a test only change, a `Close` call was missing on a server in a
test.

**Link to tracking Issue:** #30438 

**Testing:**
All existing tests are passing, as well as added `goleak` check.
  • Loading branch information
crobert-1 authored Apr 13, 2024
1 parent b142064 commit 365bb7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ func TestGetContributors(t *testing.T) {
ghs.cfg.GitHubOrg = tc.org

server := httptest.NewServer(tc.server)
defer func() { server.Close() }()

client := github.NewClient(nil)
url, _ := url.Parse(server.URL + "/api-v3" + "/")
Expand Down
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 githubscraper

import (
"testing"

"go.uber.org/goleak"
)

func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}

0 comments on commit 365bb7c

Please sign in to comment.