From d51d1b3090760d226a10786fba233f648b3ad662 Mon Sep 17 00:00:00 2001 From: Damien Mathieu <42@dmathieu.com> Date: Wed, 23 Feb 2022 00:03:17 +0100 Subject: [PATCH] Use randomly-available port in otlp exporters tests (#2627) * use randomly-available port in otlp exporters tests * Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Co-authored-by: Tyler Yahn * Update exporters/otlp/otlptrace/otlptracegrpc/client_test.go Co-authored-by: Tyler Yahn Co-authored-by: Tyler Yahn Co-authored-by: Anthony Mirabella --- exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go | 8 ++++---- exporters/otlp/otlptrace/otlptracegrpc/client_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go index bc979541c90..dc7eeda51d9 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go @@ -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() @@ -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() }() @@ -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() @@ -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() diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go index 9a02ca227b6..191ff23afd4 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client_test.go @@ -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)