diff --git a/CHANGELOG-developer.next.asciidoc b/CHANGELOG-developer.next.asciidoc index 15d65cf131b..58f9cea5211 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 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 { diff --git a/packetbeat/route/route_windows_test.go b/packetbeat/route/route_windows_test.go index f216dabc338..1b513125f2d 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 { @@ -152,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]) @@ -165,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 } }