Skip to content

Commit

Permalink
test: add test for concurrent statistics sampling
Browse files Browse the repository at this point in the history
The test currently fails as `PacketsSent` is not protected by `statsMu`
in `sendICMP`.

Signed-off-by: Per Hallgren <[email protected]>
  • Loading branch information
perhallgren committed Feb 3, 2025
1 parent 50c55f1 commit 38075b8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,3 +870,11 @@ func TestSetResolveTimeout(t *testing.T) {
err = p.SetAddr("127.0.0.1")
AssertNoError(t, err)
}

func TestRunStatisticsConcurrent(t *testing.T) {
p := New("www.google.com")
p.Count = 1
p.Interval = time.Millisecond
go p.Statistics()
p.Run()
}

0 comments on commit 38075b8

Please sign in to comment.