Skip to content

Commit

Permalink
Use randomly-available port in otlp exporters tests (#2627)
Browse files Browse the repository at this point in the history
* use randomly-available port in otlp exporters tests

* Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Update exporters/otlp/otlptrace/otlptracegrpc/client_test.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
  • Loading branch information
3 people committed Feb 22, 2022
1 parent 8ba8f68 commit d51d1b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go
Expand Up @@ -93,7 +93,7 @@ func newGRPCExporter(t *testing.T, ctx context.Context, endpoint string, additio
}

func newExporterEndToEndTest(t *testing.T, additionalOpts []otlpmetricgrpc.Option) {
mc := runMockCollectorAtEndpoint(t, "localhost:56561")
mc := runMockCollector(t)

defer func() {
_ = mc.stop()
Expand All @@ -115,7 +115,7 @@ func newExporterEndToEndTest(t *testing.T, additionalOpts []otlpmetricgrpc.Optio
}

func TestExporterShutdown(t *testing.T) {
mc := runMockCollectorAtEndpoint(t, "localhost:56561")
mc := runMockCollector(t)
defer func() {
_ = mc.Stop()
}()
Expand Down Expand Up @@ -296,7 +296,7 @@ func TestStartErrorInvalidAddress(t *testing.T) {
}

func TestEmptyData(t *testing.T) {
mc := runMockCollectorAtEndpoint(t, "localhost:56561")
mc := runMockCollector(t)

defer func() {
_ = mc.stop()
Expand All @@ -314,7 +314,7 @@ func TestEmptyData(t *testing.T) {
}

func TestFailedMetricTransform(t *testing.T) {
mc := runMockCollectorAtEndpoint(t, "localhost:56561")
mc := runMockCollector(t)

defer func() {
_ = mc.stop()
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/otlptrace/otlptracegrpc/client_test.go
Expand Up @@ -374,7 +374,7 @@ func TestStartErrorInvalidAddress(t *testing.T) {
}

func TestEmptyData(t *testing.T) {
mc := runMockCollectorAtEndpoint(t, "localhost:56561")
mc := runMockCollector(t)
t.Cleanup(func() { require.NoError(t, mc.stop()) })

<-time.After(5 * time.Millisecond)
Expand Down

0 comments on commit d51d1b3

Please sign in to comment.