Skip to content

Commit 9f780ae

Browse files
bacherflpellared
andauthored
otelconf: skip flaky exporter tests on windows (#7469)
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com> Co-authored-by: Robert Pająk <pellared@hotmail.com>
1 parent e6f4bb9 commit 9f780ae

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

.lycheeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
http://localhost
22
http://169.254.169.254/metadata/instance/compute
3+
https://10.0.0.0
4+
https://localhost:4317

otelconf/v0.3.0/log_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"os"
1313
"path/filepath"
1414
"reflect"
15+
"runtime"
1516
"strings"
1617
"testing"
1718
"time"
@@ -706,6 +707,10 @@ func TestLogProcessor(t *testing.T) {
706707
}
707708

708709
func Test_otlpGRPCLogExporter(t *testing.T) {
710+
if runtime.GOOS == "windows" {
711+
// TODO (#7446): Fix the flakiness on Windows.
712+
t.Skip("Test is flaky on Windows.")
713+
}
709714
type args struct {
710715
ctx context.Context
711716
otlpConfig *OTLP
@@ -841,10 +846,15 @@ func startGRPCLogsCollector(t *testing.T, listener net.Listener, serverOptions [
841846
c := &grpcLogsCollector{}
842847

843848
collogpb.RegisterLogsServiceServer(srv, c)
844-
go func() { _ = srv.Serve(listener) }()
849+
850+
errCh := make(chan error, 1)
851+
go func() { errCh <- srv.Serve(listener) }()
845852

846853
t.Cleanup(func() {
847-
srv.Stop()
854+
srv.GracefulStop()
855+
if err := <-errCh; err != nil && !errors.Is(err, grpc.ErrServerStopped) {
856+
assert.NoError(t, err)
857+
}
848858
})
849859
}
850860

otelconf/v0.3.0/metric_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"os"
1515
"path/filepath"
1616
"reflect"
17+
"runtime"
1718
"strings"
1819
"testing"
1920
"time"
@@ -1398,6 +1399,10 @@ func TestPrometheusIPv6(t *testing.T) {
13981399
}
13991400

14001401
func Test_otlpGRPCMetricExporter(t *testing.T) {
1402+
if runtime.GOOS == "windows" {
1403+
// TODO (#7446): Fix the flakiness on Windows.
1404+
t.Skip("Test is flaky on Windows.")
1405+
}
14011406
type args struct {
14021407
ctx context.Context
14031408
otlpConfig *OTLPMetric
@@ -1548,10 +1553,15 @@ func startGRPCMetricCollector(t *testing.T, listener net.Listener, serverOptions
15481553
c := &grpcMetricCollector{}
15491554

15501555
v1.RegisterMetricsServiceServer(srv, c)
1551-
go func() { _ = srv.Serve(listener) }()
1556+
1557+
errCh := make(chan error, 1)
1558+
go func() { errCh <- srv.Serve(listener) }()
15521559

15531560
t.Cleanup(func() {
1554-
srv.Stop()
1561+
srv.GracefulStop()
1562+
if err := <-errCh; err != nil && !errors.Is(err, grpc.ErrServerStopped) {
1563+
assert.NoError(t, err)
1564+
}
15551565
})
15561566
}
15571567

otelconf/v0.3.0/trace_test.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"os"
1313
"path/filepath"
1414
"reflect"
15+
"runtime"
1516
"strings"
1617
"testing"
1718
"time"
@@ -854,6 +855,10 @@ func TestSampler(t *testing.T) {
854855
}
855856

856857
func Test_otlpGRPCTraceExporter(t *testing.T) {
858+
if runtime.GOOS == "windows" {
859+
// TODO (#7446): Fix the flakiness on Windows.
860+
t.Skip("Test is flaky on Windows.")
861+
}
857862
type args struct {
858863
ctx context.Context
859864
otlpConfig *OTLP
@@ -989,10 +994,15 @@ func startGRPCTraceCollector(t *testing.T, listener net.Listener, serverOptions
989994
c := &grpcTraceCollector{}
990995

991996
v1.RegisterTraceServiceServer(srv, c)
992-
go func() { _ = srv.Serve(listener) }()
997+
998+
errCh := make(chan error, 1)
999+
go func() { errCh <- srv.Serve(listener) }()
9931000

9941001
t.Cleanup(func() {
995-
srv.Stop()
1002+
srv.GracefulStop()
1003+
if err := <-errCh; err != nil && !errors.Is(err, grpc.ErrServerStopped) {
1004+
assert.NoError(t, err)
1005+
}
9961006
})
9971007
}
9981008

0 commit comments

Comments
 (0)