From 7666aa9dd42fddbb063ebf870d37e7df13bb587c Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Fri, 7 Jun 2024 13:56:39 +0930 Subject: [PATCH 1/4] packetbeat/route: trigger failure DO NOT MERGE --- packetbeat/route/route_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/packetbeat/route/route_test.go b/packetbeat/route/route_test.go index 2858d8521da..3e848bb56ab 100644 --- a/packetbeat/route/route_test.go +++ b/packetbeat/route/route_test.go @@ -32,7 +32,6 @@ import ( ) func TestDefault(t *testing.T) { - t.Skip("Flaky test: https://github.com/elastic/beats/issues/39698") for _, family := range []int{syscall.AF_INET, syscall.AF_INET6} { wantIface, wantIndex, wantErr := defaultRoute(family) if wantErr != nil && wantErr != ErrNotFound { From c15081ecc898acf5035ec98beec1e6b99dee4c10 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Fri, 7 Jun 2024 14:26:50 +0930 Subject: [PATCH 2/4] packetbeat/route: fix defaultRoute test helper --- packetbeat/route/route_windows_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packetbeat/route/route_windows_test.go b/packetbeat/route/route_windows_test.go index f216dabc338..28d3c5f21a7 100644 --- a/packetbeat/route/route_windows_test.go +++ b/packetbeat/route/route_windows_test.go @@ -54,6 +54,9 @@ func defaultRoute(af int) (name string, index int, err error) { for inTable := false; sc.Scan(); { f := strings.Fields(sc.Text()) if len(f) == 0 { + if inTable { + break + } continue } if !inTable { @@ -94,6 +97,9 @@ func defaultRoute(af int) (name string, index int, err error) { for inTable := false; sc.Scan(); { f := fieldsN(sc.Text(), 5) if len(f) == 0 { + if inTable { + break + } continue } if !inTable { From 5618a0f9b42e78590c1b4fa1c65a7478101fcdfc Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Fri, 7 Jun 2024 15:03:56 +0930 Subject: [PATCH 3/4] packetbeat/route: fix fieldsN test helper --- packetbeat/route/route_windows_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packetbeat/route/route_windows_test.go b/packetbeat/route/route_windows_test.go index 28d3c5f21a7..1b513125f2d 100644 --- a/packetbeat/route/route_windows_test.go +++ b/packetbeat/route/route_windows_test.go @@ -158,6 +158,7 @@ func fieldsN(s string, n int) []string { } var f []string for s != "" { + l := len(s) for i, r := range s { if unicode.IsSpace(r) { f = append(f, s[:i]) @@ -171,7 +172,7 @@ func fieldsN(s string, n int) []string { break } } - if len(f) == n-1 { + if len(f) == n-1 || len(s) == l { break } } From d432146f042de3bfccfa1500d6c3be1d6866cdd3 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Fri, 7 Jun 2024 15:18:46 +0930 Subject: [PATCH 4/4] add changelog entry --- CHANGELOG-developer.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG-developer.next.asciidoc b/CHANGELOG-developer.next.asciidoc index cf378879b15..3f03fcf1950 100644 --- a/CHANGELOG-developer.next.asciidoc +++ b/CHANGELOG-developer.next.asciidoc @@ -98,6 +98,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only. - Fix copy arguments for strict aligned architectures. {pull}36976[36976] - Fix panic when more than 32767 pipeline clients are active. {issue}38197[38197] {pull}38556[38556] - Skip flakey metrics test on windows in filebeat httpjson input. {issue}39676[39676] {pull}39678[39678] +- Fix flakey test on Windows 2022 in packetbeat/route. {issue}39698[39698] {pull}39822[39822] ==== Added