From ff2fdbe5d3bccd8178b911f1c0bf7aecf9e6e0a6 Mon Sep 17 00:00:00 2001 From: Petrie Date: Sun, 3 Jul 2022 22:26:13 +0800 Subject: [PATCH] fix exporter unittest occasional error --- exporters/otlp/otlptrace/internal/otlptracetest/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exporters/otlp/otlptrace/internal/otlptracetest/client.go b/exporters/otlp/otlptrace/internal/otlptracetest/client.go index aedb8f4a9d2e..2d37be4c715b 100644 --- a/exporters/otlp/otlptrace/internal/otlptracetest/client.go +++ b/exporters/otlp/otlptrace/internal/otlptracetest/client.go @@ -69,7 +69,7 @@ func testClientStopHonorsTimeout(t *testing.T, client otlptrace.Client) { defer cancel() <-ctx.Done() - if err := e.Shutdown(ctx); !errors.Is(err, context.DeadlineExceeded) { + if err := e.Shutdown(ctx); !errors.Is(err, context.DeadlineExceeded) || err == nil { t.Errorf("expected context DeadlineExceeded error, got %v", err) } } @@ -88,7 +88,7 @@ func testClientStopHonorsCancel(t *testing.T, client otlptrace.Client) { ctx, cancel := context.WithCancel(context.Background()) cancel() - if err := e.Shutdown(ctx); !errors.Is(err, context.Canceled) { + if err := e.Shutdown(ctx); !errors.Is(err, context.Canceled) || err == nil { t.Errorf("expected context canceled error, got %v", err) } }