Skip to content

Commit

Permalink
[chore][receiver/snowflake] Enable goleak check (open-telemetry#32182)
Browse files Browse the repository at this point in the history
**Description:**
This enables the `goleak` check for the Snowflake receiver to help
ensure no goroutines are being leaked. This is a test only change, a
couple shutdown/close calls were missing.

**Link to tracking Issue:** open-telemetry#30438

**Testing:** 
All existing tests are passing, as well as added `goleak` check.
  • Loading branch information
crobert-1 authored and rimitchell committed May 8, 2024
1 parent aa0e88d commit f717b4f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 3 additions & 2 deletions receiver/snowflakereceiver/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

func TestDefaultClientCreation(t *testing.T) {
_, err := newDefaultClient(componenttest.NewNopTelemetrySettings(), Config{
c, err := newDefaultClient(componenttest.NewNopTelemetrySettings(), Config{
Username: "testuser",
Password: "testPassword",
Account: "testAccount",
Expand All @@ -27,7 +27,8 @@ func TestDefaultClientCreation(t *testing.T) {
Database: "testDatabase",
Role: "testRole",
})
assert.Equal(t, nil, err)
assert.NoError(t, err)
assert.NoError(t, c.client.Close())
}

// test query wrapper
Expand Down
15 changes: 15 additions & 0 deletions receiver/snowflakereceiver/package_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package snowflakereceiver

import (
"testing"

"go.uber.org/goleak"
)

// Regarding the godbus/dbus ignore: see https://github.com/99designs/keyring/issues/103
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m, goleak.IgnoreAnyFunction("github.com/godbus/dbus.(*Conn).inWorker"))
}
1 change: 1 addition & 0 deletions receiver/snowflakereceiver/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func TestStart(t *testing.T) {
scraper := newSnowflakeMetricsScraper(receivertest.NewNopCreateSettings(), cfg)
err := scraper.start(context.Background(), componenttest.NewNopHost())
require.NoError(t, err, "Problem starting scraper")
require.NoError(t, scraper.shutdown(context.Background()))
}

// wrapper type for convenience
Expand Down

0 comments on commit f717b4f

Please sign in to comment.