refactor(tests): clean up whitespace in TestTransportLeak function
All checks were successful
Go Build Test / Build (windows, arm) (pull_request) Successful in 9m26s
Go Build Test / Build (darwin, arm64) (pull_request) Successful in 9m24s
Bearer / scan (pull_request) Successful in 9s
Go Benchmarks / Run Benchmarks (pull_request) Successful in 55s
Go Build Test / Build (linux, arm64) (pull_request) Successful in 39s
Go Build Test / Build (windows, arm64) (pull_request) Successful in 38s
Go Build Test / Build (windows, amd64) (pull_request) Successful in 44s
Go Build Test / Build (linux, arm) (pull_request) Successful in 42s
Go Build Test / Build (freebsd, amd64) (pull_request) Successful in 46s
Go Build Test / Build (freebsd, arm64) (pull_request) Successful in 30s
Go Build Test / Build (js, wasm) (pull_request) Successful in 34s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (pull_request) Successful in 1m18s
Go Revive Lint / lint (pull_request) Successful in 1m14s
Run Gosec / tests (pull_request) Successful in 1m28s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (pull_request) Successful in 3m6s
Go Build Test / Build (darwin, amd64) (pull_request) Successful in 9m23s
Go Build Test / Build (freebsd, arm) (pull_request) Successful in 9m23s
Go Build Test / Build (linux, amd64) (pull_request) Successful in 9m26s

This commit is contained in:
2026-01-02 17:47:34 -06:00
parent f6b5f3ee82
commit f80d50c27b

View File

@@ -16,7 +16,7 @@ func TestTransportLeak(t *testing.T) {
baseline := runtime.NumGoroutine()
cfg := &common.ReticulumConfig{}
// Create and close many transport instances
for i := 0; i < 100; i++ {
tr := NewTransport(cfg)
@@ -28,13 +28,12 @@ func TestTransportLeak(t *testing.T) {
// Wait for goroutines to finish
time.Sleep(100 * time.Millisecond)
runtime.GC()
final := runtime.NumGoroutine()
// We allow a small margin for other system goroutines,
// We allow a small margin for other system goroutines,
// but 100 leaks would be very obvious.
if final > baseline+5 {
t.Errorf("Potential goroutine leak: baseline %d, final %d", baseline, final)
}
}