From f77a441756900f489523856ad8658e39b7b67dfc Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Tue, 13 Feb 2024 14:09:55 +0100 Subject: [PATCH] add goleak to packages using the host struct --- go.mod | 1 + go.sum | 1 + host/contracts/revenue_test.go | 5 +++++ rhp/v2/rpc_test.go | 5 +++++ rhp/v3/websocket_test.go | 5 +++++ 5 files changed, 17 insertions(+) diff --git a/go.mod b/go.mod index 2f9d7b93..1867c91c 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,7 @@ require ( go.sia.tech/renterd v0.6.0 go.sia.tech/siad v1.5.10-0.20230228235644-3059c0b930ca go.sia.tech/web/hostd v0.37.0 + go.uber.org/goleak v1.2.0 go.uber.org/zap v1.26.0 golang.org/x/sys v0.16.0 golang.org/x/term v0.16.0 diff --git a/go.sum b/go.sum index 6af4a764..d5975fa1 100644 --- a/go.sum +++ b/go.sum @@ -277,6 +277,7 @@ golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1m golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= diff --git a/host/contracts/revenue_test.go b/host/contracts/revenue_test.go index a74d3aea..b8c28a1e 100644 --- a/host/contracts/revenue_test.go +++ b/host/contracts/revenue_test.go @@ -14,10 +14,15 @@ import ( "go.sia.tech/hostd/internal/test" rhp3 "go.sia.tech/hostd/internal/test/rhp/v3" "go.sia.tech/hostd/persist/sqlite" + "go.uber.org/goleak" "go.uber.org/zap/zaptest" "lukechampine.com/frand" ) +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} + func checkRevenueConsistency(s *sqlite.Store, potential, earned metrics.Revenue) error { time.Sleep(time.Second) // commit time diff --git a/rhp/v2/rpc_test.go b/rhp/v2/rpc_test.go index a03563f6..13d62c49 100644 --- a/rhp/v2/rpc_test.go +++ b/rhp/v2/rpc_test.go @@ -13,10 +13,15 @@ import ( "go.sia.tech/core/types" "go.sia.tech/hostd/internal/test" "go.sia.tech/renterd/wallet" + "go.uber.org/goleak" "go.uber.org/zap/zaptest" "lukechampine.com/frand" ) +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} + func TestSettings(t *testing.T) { log := zaptest.NewLogger(t) renter, host, err := test.NewTestingPair(t.TempDir(), log) diff --git a/rhp/v3/websocket_test.go b/rhp/v3/websocket_test.go index ea212198..e257bfe7 100644 --- a/rhp/v3/websocket_test.go +++ b/rhp/v3/websocket_test.go @@ -7,10 +7,15 @@ import ( rhp3 "go.sia.tech/core/rhp/v3" "go.sia.tech/hostd/internal/test" + "go.uber.org/goleak" "go.uber.org/zap/zaptest" "nhooyr.io/websocket" ) +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} + func TestWebSockets(t *testing.T) { log := zaptest.NewLogger(t) renter, host, err := test.NewTestingPair(t.TempDir(), log)