Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flaky Test: packetbeat/route TestDefault - panic: runtime error: index out of range [3] with length 3 #39698

Closed
belimawr opened this issue May 23, 2024 · 3 comments · Fixed by #39822
Labels
flaky-test Unstable or unreliable test cases. Team:Security-Linux Platform Linux Platform Team in Security Solution Team:Security-Windows Platform Windows Platform Team in Security Solution

Comments

@belimawr
Copy link
Contributor

Flaky Test

Stack Trace

2024-05-23 03:18:35 EDT	=== Failed
2024-05-23 03:18:35 EDT	=== FAIL: packetbeat/route TestDefault (0.87s)
2024-05-23 03:18:35 EDT	panic: runtime error: index out of range [3] with length 3 [recovered]
2024-05-23 03:18:35 EDT		panic: runtime error: index out of range [3] with length 3
2024-05-23 03:18:35 EDT	
2024-05-23 03:18:35 EDT	goroutine 6 [running]:
2024-05-23 03:18:35 EDT	testing.tRunner.func1.2({0x899340, 0xc0000909f0})
2024-05-23 03:18:35 EDT		C:/Users/Buildkite/.go/go-1.21.10/src/testing/testing.go:1545 +0x238
2024-05-23 03:18:35 EDT	testing.tRunner.func1()
2024-05-23 03:18:35 EDT		C:/Users/Buildkite/.go/go-1.21.10/src/testing/testing.go:1548 +0x397
2024-05-23 03:18:35 EDT	panic({0x899340?, 0xc0000909f0?})
2024-05-23 03:18:35 EDT		C:/Users/Buildkite/.go/go-1.21.10/src/runtime/panic.go:914 +0x21f
2024-05-23 03:18:35 EDT	github.com/elastic/beats/v7/packetbeat/route.defaultRoute(0xc0000c2ab7?)
2024-05-23 03:18:35 EDT		C:/buildkite-agent/builds/bk-agent-prod-gcp-1716448135293881985/elastic/beats-packetbeat/packetbeat/route/route_windows_test.go:63 +0xd72
2024-05-23 03:18:35 EDT	github.com/elastic/beats/v7/packetbeat/route.TestDefault(0xc00003b520)
2024-05-23 03:18:35 EDT		C:/buildkite-agent/builds/bk-agent-prod-gcp-1716448135293881985/elastic/beats-packetbeat/packetbeat/route/route_test.go:36 +0x72
2024-05-23 03:18:35 EDT	testing.tRunner(0xc00003b520, 0x8ba630)
2024-05-23 03:18:35 EDT		C:/Users/Buildkite/.go/go-1.21.10/src/testing/testing.go:1595 +0xff
2024-05-23 03:18:35 EDT	created by testing.(*T).Run in goroutine 1
2024-05-23 03:18:35 EDT		C:/Users/Buildkite/.go/go-1.21.10/src/testing/testing.go:1648 +0x3ad

When I run the same tests on Linux I get an error instead of a panic:

tiago@millennium-falcon beats/packetbeat/route  v1.22.2  HEAD [$?] % go test ./...
--- FAIL: TestDefault (0.00s)
    route_test.go:43: unexpected error from Default(10): got:route: not found want:<nil>
    route_test.go:59: unexpected interface for family 10: got: want:wlp9s0
    route_test.go:63: unexpected interface for family 10: got:-1 want:3
FAIL
FAIL    github.com/elastic/beats/v7/packetbeat/route    0.036s
FAIL

I also tested it on my Windows machine and it passed, even with 100 repetitions.

@belimawr belimawr added the flaky-test Unstable or unreliable test cases. label May 23, 2024
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 23, 2024
@belimawr belimawr changed the title Flaky Test: packetbeat/route TestDefault - panic: runtime error: index out of range [3] with length 3 Flaky Test: packetbeat/route TestDefault - panic: runtime error: index out of range [3] with length 3 May 23, 2024
@belimawr belimawr added Team:Security-Linux Platform Linux Platform Team in Security Solution Team:Security-Windows Platform Windows Platform Team in Security Solution labels May 23, 2024
@elasticmachine
Copy link
Collaborator

Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/sec-windows-platform (Team:Security-Windows Platform)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label May 23, 2024
efd6 added a commit to efd6/beats that referenced this issue May 29, 2024
This improves the error handling for the testing invocation of netsh to allow
the cause of elastic#39698 to be identified.
efd6 added a commit that referenced this issue May 29, 2024
This improves the error handling for the testing invocation of netsh to allow
the cause of #39698 to be identified.
@efd6
Copy link
Contributor

efd6 commented Jun 7, 2024

It looks like this is a result of netsh now emitting version information and this not being properly handled by the helper since it was unknown behaviour.

https://buildkite.com/elastic/beats-packetbeat/builds/5344#018ff0f6-13bc-4375-84d8-5c434707c120/100-274

=== FAIL: packetbeat/route TestDefault (0.95s)
    route_test.go:38: unexpected error from defaultRoute(23): unexpected netsh  line: "netsh.exe: version 10.0.20348.1"


        Publish  Type      Met  Prefix                    Idx  Gateway/Interface Name
        -------  --------  ---  ------------------------  ---  ------------------------
        No       System    256  ::1/128                     1  Loopback Pseudo-Interface 1
        No       System    256  fe80::/64                   4  Ethernet
        No       System    256  fe80::/64                   9  vEthernet (nat)
        No       System    256  fe80::557:e168:e133:5781/128    9  vEthernet (nat)
        No       System    256  fe80::e58d:ff83:e072:e694/128    4  Ethernet
        No       System    256  ff00::/8                    1  Loopback Pseudo-Interface 1
        No       System    256  ff00::/8                    4  Ethernet
        No       System    256  ff00::/8                    9  vEthernet (nat)

        netsh.exe: version 10.0.20348.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flaky-test Unstable or unreliable test cases. Team:Security-Linux Platform Linux Platform Team in Security Solution Team:Security-Windows Platform Windows Platform Team in Security Solution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants