Skip to content

Commit

Permalink
[chore][exporter/logzioexporter] Enable goleak check (#31151)
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` checks in the Logz.io exporter to help ensure no
goroutines are being leaked. This is a test only change as the only
thing necessary was to add a missing close call on a server 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` check.
  • Loading branch information
crobert-1 authored Mar 1, 2024
1 parent 3401d8a commit 47cf0f4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions exporter/logzioexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (
go.opentelemetry.io/collector/semconv v0.95.0
go.opentelemetry.io/otel/metric v1.23.1
go.opentelemetry.io/otel/trace v1.23.1
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20240108191215-35c7eff3a6b1
google.golang.org/protobuf v1.32.0
Expand Down
1 change: 1 addition & 0 deletions exporter/logzioexporter/jsonlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func TestSetTimeStamp(t *testing.T) {
recordedRequests, _ = io.ReadAll(req.Body)
rw.WriteHeader(http.StatusOK)
}))
defer func() { server.Close() }()
ld := generateLogsOneEmptyTimestamp()
cfg := &Config{
Region: "us",
Expand Down
14 changes: 14 additions & 0 deletions exporter/logzioexporter/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 logzioexporter

import (
"testing"

"go.uber.org/goleak"
)

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

0 comments on commit 47cf0f4

Please sign in to comment.