From ac1fdd277e61dbe21ae95dd9036eeb7cbd85ffc3 Mon Sep 17 00:00:00 2001 From: Dhanu Saputra <35093673+dhanusaputra@users.noreply.github.com> Date: Tue, 22 Feb 2022 03:10:16 +0700 Subject: [PATCH] ci: migrate tests to ginkgo v2 (#845) * Migrate tests to ginkgo v2 * fix tests * mod tidy * import pyroscope goldga --- benchmark/internal/cireport/cireport_test.go | 2 +- .../internal/cireport/metareport_test.go | 5 +- .../internal/cireport/screenshotter_test.go | 2 +- .../internal/cireport/tablereport_test.go | 4 +- cmd/pyroscope/command/exec_test.go | 2 +- cmd/pyroscope/pyroscope_suite_test.go | 2 +- go.mod | 6 +- go.sum | 32 +++-- pkg/adhoc/server/server_suite_test.go | 2 +- pkg/adhoc/server/server_test.go | 2 +- pkg/admin/admin_integration_test.go | 2 +- pkg/admin/admin_test.go | 2 +- pkg/admin/client_test.go | 2 +- pkg/admin/controller_test.go | 3 +- pkg/admin/http_over_uds_server_test.go | 2 +- pkg/agent/agent_suite_test.go | 2 +- pkg/agent/dotnetspy/dotnetspy_suite_test.go | 3 +- pkg/agent/dotnetspy/dotnetspy_test.go | 3 +- pkg/agent/gospy/gospy_suite_test.go | 2 +- pkg/agent/gospy/gospy_test.go | 2 +- pkg/agent/profiler/profiler_suite_test.go | 2 +- pkg/agent/session_test.go | 71 +++++----- pkg/agent/spy/spy_suite_test.go | 2 +- pkg/agent/target/target_suite_test.go | 2 +- pkg/agent/target/target_test.go | 3 +- .../upstream/direct/direct_suite_test.go | 2 +- .../upstream/remote/remote_suite_test.go | 2 +- pkg/agent/upstream/remote/remote_test.go | 2 +- pkg/agent/upstream/upstream_suite_test.go | 2 +- pkg/analytics/analytics_suite_test.go | 2 +- pkg/analytics/analytics_test.go | 2 +- pkg/api/api_key_test.go | 2 +- pkg/api/api_suite_test.go | 2 +- pkg/api/auth_test.go | 2 +- pkg/api/user_test.go | 2 +- pkg/build/build_suite_test.go | 2 +- pkg/cli/cli_suite_test.go | 2 +- pkg/cli/command_test.go | 2 +- pkg/cli/flags_test.go | 2 +- pkg/config/config_suite_test.go | 2 +- pkg/convert/convert_suite_test.go | 2 +- pkg/convert/parser_test.go | 2 +- pkg/exec/connect_test.go | 4 +- pkg/exec/exec_suite_test.go | 2 +- pkg/exec/exec_test.go | 4 +- pkg/flameql/flameql_suite_test.go | 2 +- pkg/flameql/flameql_test.go | 2 +- pkg/flameql/parse_test.go | 2 +- pkg/health/controller_test.go | 2 +- pkg/health/health_suite_test.go | 2 +- pkg/model/api_key_test.go | 3 +- pkg/model/model_suite_test.go | 2 +- pkg/model/role_test.go | 3 +- pkg/model/user_test.go | 3 +- pkg/server/build_test.go | 2 +- pkg/server/config_test.go | 2 +- pkg/server/controller_gzip_test.go | 26 ++-- pkg/server/controller_https_test.go | 2 +- pkg/server/ingest_test.go | 2 +- pkg/server/render_test.go | 2 +- pkg/server/server_suite_test.go | 2 +- pkg/service/api_key_test.go | 2 +- pkg/service/jwt_token_test.go | 2 +- pkg/service/service_suite_test.go | 2 +- pkg/service/user_test.go | 2 +- pkg/storage/cache/cache_suite_test.go | 2 +- pkg/storage/cache/cache_test.go | 114 ++++++++------- pkg/storage/config_test.go | 2 +- pkg/storage/dict/dict_suite_test.go | 2 +- pkg/storage/dict/dict_test.go | 2 +- pkg/storage/dict/serialize_test.go | 2 +- pkg/storage/dimension/dimension_suite_test.go | 2 +- pkg/storage/dimension/dimension_test.go | 2 +- pkg/storage/labels/labels_suite_test.go | 2 +- pkg/storage/segment/fuzz_test.go | 36 +++-- pkg/storage/segment/key_test.go | 2 +- pkg/storage/segment/overlap_test.go | 2 +- pkg/storage/segment/relationship_test.go | 2 +- pkg/storage/segment/segment_suite_test.go | 2 +- pkg/storage/segment/segment_test.go | 2 +- pkg/storage/segment/serialization_test.go | 2 +- pkg/storage/segment/timeline_test.go | 134 ++++++++++-------- pkg/storage/storage_delete_test.go | 2 +- pkg/storage/storage_suite_test.go | 2 +- pkg/storage/storage_test.go | 2 +- pkg/storage/tree/flamebearer_test.go | 2 +- pkg/storage/tree/pprof_test.go | 2 +- pkg/storage/tree/profile_finder_test.go | 2 +- pkg/storage/tree/serialize_nodict_test.go | 2 +- pkg/storage/tree/serialize_test.go | 2 +- pkg/storage/tree/tree_suite_test.go | 2 +- pkg/storage/tree/tree_test.go | 2 +- pkg/storage/tree/treediff_test.go | 2 +- pkg/structs/cappedarr/cappedarr_suite_test.go | 2 +- pkg/structs/cappedarr/cappedarr_test.go | 2 +- .../flamebearer/flamebearer_suite_test.go | 2 +- pkg/structs/flamebearer/flamebearer_test.go | 2 +- pkg/structs/merge/merge_suite_test.go | 2 +- pkg/structs/sortedmap/sortedmap_suite_test.go | 2 +- pkg/structs/transporttrie/diff_test.go | 2 +- pkg/structs/transporttrie/merge_test.go | 2 +- .../transporttrie/transporttrie_suite_test.go | 2 +- pkg/structs/transporttrie/trie_test.go | 2 +- pkg/testing/config.go | 2 +- pkg/testing/tmpdir.go | 2 +- pkg/util/attime/attime_suite_test.go | 2 +- pkg/util/attime/attime_test.go | 2 +- pkg/util/bytesize/bytesize_suite_test.go | 2 +- pkg/util/bytesize/bytesize_test.go | 2 +- pkg/util/caps/caps_suite_test.go | 2 +- pkg/util/disk/disk_suite_test.go | 2 +- pkg/util/disk/usage_test.go | 2 +- pkg/util/file/file_suite_test.go | 2 +- .../hyperloglog/hyperloglog_suite_test.go | 2 +- pkg/util/hyperloglog/hyperloglog_test.go | 2 +- pkg/util/id/id_suite_test.go | 2 +- pkg/util/names/names_suite_test.go | 2 +- pkg/util/serialization/metadata_test.go | 2 +- .../serialization/serialization_suite_test.go | 2 +- pkg/util/slices/slices_suite_test.go | 2 +- pkg/util/varint/varint_suite_test.go | 2 +- pyroscope_suite_test.go | 2 +- scripts/decode-resp/decode_suite_test.go | 2 +- scripts/decode-resp/decode_test.go | 2 +- tools/tools.go | 2 +- 125 files changed, 355 insertions(+), 316 deletions(-) diff --git a/benchmark/internal/cireport/cireport_test.go b/benchmark/internal/cireport/cireport_test.go index a9f3db5159..0079a6480f 100644 --- a/benchmark/internal/cireport/cireport_test.go +++ b/benchmark/internal/cireport/cireport_test.go @@ -6,7 +6,7 @@ package cireport_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/benchmark/internal/cireport/metareport_test.go b/benchmark/internal/cireport/metareport_test.go index 8deb8ad295..c2d3fbab9e 100644 --- a/benchmark/internal/cireport/metareport_test.go +++ b/benchmark/internal/cireport/metareport_test.go @@ -3,9 +3,9 @@ package cireport_test import ( "github.com/pyroscope-io/pyroscope/benchmark/internal/cireport" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/tommy351/goldga" + "github.com/pyroscope-io/goldga" ) var _ = Describe("metareport", func() { @@ -15,6 +15,7 @@ var _ = Describe("metareport", func() { report, err := mr.Report("Server Benchmark", []string{"execution=5m", "seed=4"}) Expect(err).ToNot(HaveOccurred()) + Expect(report).To(goldga.Match()) }) diff --git a/benchmark/internal/cireport/screenshotter_test.go b/benchmark/internal/cireport/screenshotter_test.go index 4c8ac3cf33..1236eca485 100644 --- a/benchmark/internal/cireport/screenshotter_test.go +++ b/benchmark/internal/cireport/screenshotter_test.go @@ -6,7 +6,7 @@ import ( "net/http" "net/http/httptest" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/benchmark/internal/cireport" ) diff --git a/benchmark/internal/cireport/tablereport_test.go b/benchmark/internal/cireport/tablereport_test.go index 5a3b10955c..34c13a10d5 100644 --- a/benchmark/internal/cireport/tablereport_test.go +++ b/benchmark/internal/cireport/tablereport_test.go @@ -7,9 +7,9 @@ import ( "github.com/pyroscope-io/pyroscope/benchmark/internal/cireport" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/tommy351/goldga" + "github.com/pyroscope-io/goldga" ) type mockQuerier struct { diff --git a/cmd/pyroscope/command/exec_test.go b/cmd/pyroscope/command/exec_test.go index 6ccf85b76d..dd5df085c8 100644 --- a/cmd/pyroscope/command/exec_test.go +++ b/cmd/pyroscope/command/exec_test.go @@ -5,7 +5,7 @@ import ( "io" "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/cmd/pyroscope/pyroscope_suite_test.go b/cmd/pyroscope/pyroscope_suite_test.go index 085b4defc2..dbc16801d6 100644 --- a/cmd/pyroscope/pyroscope_suite_test.go +++ b/cmd/pyroscope/pyroscope_suite_test.go @@ -3,7 +3,7 @@ package main_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/go.mod b/go.mod index b6ac5dce27..6397daffbc 100644 --- a/go.mod +++ b/go.mod @@ -54,13 +54,14 @@ require ( github.com/mitchellh/mapstructure v1.4.1 github.com/morikuni/aec v1.0.0 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f - github.com/onsi/ginkgo v1.16.2 - github.com/onsi/gomega v1.12.0 + github.com/onsi/ginkgo/v2 v2.1.2 + github.com/onsi/gomega v1.17.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.11.0 github.com/prometheus/common v0.32.1 github.com/pyroscope-io/client v0.0.0-20211206204731-3fd0a4b8239c github.com/pyroscope-io/dotnetdiag v1.2.1 + github.com/pyroscope-io/goldga v0.4.2-0.20220218190441-817afcc3a7f1 github.com/rivo/uniseg v0.2.0 // indirect github.com/rlmcpherson/s3gof3r v0.5.0 github.com/shirou/gopsutil v3.21.4+incompatible @@ -71,7 +72,6 @@ require ( github.com/spf13/viper v1.8.1 github.com/stretchr/testify v1.7.0 github.com/tklauser/go-sysconf v0.3.6 // indirect - github.com/tommy351/goldga v0.3.0 github.com/twmb/murmur3 v1.1.5 github.com/valyala/bytebufferpool v1.0.0 github.com/wacul/ptr v1.0.0 // indirect diff --git a/go.sum b/go.sum index 306bb4a2c2..22ad800863 100644 --- a/go.sum +++ b/go.sum @@ -45,8 +45,9 @@ github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSY github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= +github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DataDog/zstd v1.4.1 h1:3oxKN3wbHibqx897utPC2LTQU4J+IHWWJO+glkAkpFM= github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= @@ -295,6 +296,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20211008130755-947d60d73cc0 h1:zHs+jv3LO743/zFGcByu2KmpbliCU2AhjcGgrdTwSG4= github.com/google/pprof v0.0.0-20211008130755-947d60d73cc0/go.mod h1:KgnwoLYCZ8IQu3XUZ8Nc/bM9CCZFOyjUNOSygVozoDg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= @@ -480,8 +482,8 @@ github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 h1:bqDmpDG49ZRnB5PcgP0RXtQvnMSgIF14M7CBd2shtXs= -github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/logrusorgru/aurora/v3 v3.0.0 h1:R6zcoZZbvVcGMvDCKo45A9U/lzYyzl5NfYIvznmDfE4= +github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= @@ -504,8 +506,9 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg= @@ -558,17 +561,17 @@ github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.2 h1:HFB2fbVIlhIfCfOW81bZFbiC/RvnpXSdhbF2/DJr134= -github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.1.2 h1:QUvZA5LiZ5EMDS0dVTQbjOvYLFs3wzcztqFU/mfR70c= +github.com/onsi/ginkgo/v2 v2.1.2/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.12.0 h1:p4oGGk2M2UJc0wWN4lHFvIB71lxsh0T/UiKCCgFADY8= -github.com/onsi/gomega v1.12.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= +github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys= @@ -612,6 +615,8 @@ github.com/pyroscope-io/client v0.0.0-20211206204731-3fd0a4b8239c h1:QVplAdQO7l4 github.com/pyroscope-io/client v0.0.0-20211206204731-3fd0a4b8239c/go.mod h1:zRdQXIGxy0H2QbKEkCmZBR6KOLLIFYLWsdzVI0MRm2E= github.com/pyroscope-io/dotnetdiag v1.2.1 h1:3XEMrfFJnZ87BiEhozyQKmCUAuMd/Spq7KChPuD2Cf0= github.com/pyroscope-io/dotnetdiag v1.2.1/go.mod h1:eFUEHCp4eD1TgcXMlJihC+R4MrqGf7nTRdWxNADbDHA= +github.com/pyroscope-io/goldga v0.4.2-0.20220218190441-817afcc3a7f1 h1:T1fDdt3E3UpaGZ7tRF2IYrUFwNyuPlIWGeCOjfINp1s= +github.com/pyroscope-io/goldga v0.4.2-0.20220218190441-817afcc3a7f1/go.mod h1:PbX5bxlj/WxyKIEAxYgNMNWUpXP4rt9GqtjfvTf8m+I= github.com/pyroscope-io/revive v1.0.6-0.20210330033039-4a71146f9dc1 h1:0v9lBNgdmVtpyyk9PP/DfpJlOHkXriu5YgNlrhQw5YE= github.com/pyroscope-io/revive v1.0.6-0.20210330033039-4a71146f9dc1/go.mod h1:tSw34BaGZ0iF+oVKDOjq1/LuxGifgW7shaJ6+dBYFXg= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -629,8 +634,9 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shirou/gopsutil v3.21.4+incompatible h1:fuHcTm5mX+wzo542cmYcV9RTGQLbnHLI5SyQ5ryTVck= github.com/shirou/gopsutil v3.21.4+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= @@ -692,8 +698,6 @@ github.com/tklauser/go-sysconf v0.3.6 h1:oc1sJWvKkmvIxhDHeKWvZS4f6AW+YcoguSfRF2/ github.com/tklauser/go-sysconf v0.3.6/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= -github.com/tommy351/goldga v0.3.0 h1:4i6cycQZZozRVxrpUTz1Wro6jEhOLOmHR2ydPbvJEgw= -github.com/tommy351/goldga v0.3.0/go.mod h1:ERe5kvAdyOOMOPO0x5pcM4SvLa2UuICfIHrFRx9mQ8Y= github.com/twmb/murmur3 v1.1.5 h1:i9OLS9fkuLzBXjt6dptlAEyk58fJsSTXbRg3SgVyqgk= github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= @@ -915,7 +919,6 @@ golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -952,6 +955,7 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211020174200-9d6173849985 h1:LOlKVhfDyahgmqa97awczplwkjzNaELFg3zRIJ13RYo= diff --git a/pkg/adhoc/server/server_suite_test.go b/pkg/adhoc/server/server_suite_test.go index 0cb623f32c..957f3f9ff4 100644 --- a/pkg/adhoc/server/server_suite_test.go +++ b/pkg/adhoc/server/server_suite_test.go @@ -3,7 +3,7 @@ package server_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/adhoc/server/server_test.go b/pkg/adhoc/server/server_test.go index c5b6999444..945c7fb722 100644 --- a/pkg/adhoc/server/server_test.go +++ b/pkg/adhoc/server/server_test.go @@ -3,7 +3,7 @@ package server_test import ( "reflect" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/adhoc/server" "github.com/pyroscope-io/pyroscope/pkg/structs/flamebearer" diff --git a/pkg/admin/admin_integration_test.go b/pkg/admin/admin_integration_test.go index 9205bdfdb8..a2ed27aa12 100644 --- a/pkg/admin/admin_integration_test.go +++ b/pkg/admin/admin_integration_test.go @@ -8,7 +8,7 @@ import ( "os" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sirupsen/logrus/hooks/test" diff --git a/pkg/admin/admin_test.go b/pkg/admin/admin_test.go index 3ac90170bb..f9b875bf99 100644 --- a/pkg/admin/admin_test.go +++ b/pkg/admin/admin_test.go @@ -4,7 +4,7 @@ package admin_test import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "testing" diff --git a/pkg/admin/client_test.go b/pkg/admin/client_test.go index 387958bade..88e24e0319 100644 --- a/pkg/admin/client_test.go +++ b/pkg/admin/client_test.go @@ -8,7 +8,7 @@ import ( "net/http" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/admin" diff --git a/pkg/admin/controller_test.go b/pkg/admin/controller_test.go index ac12e34538..ecd5f4a034 100644 --- a/pkg/admin/controller_test.go +++ b/pkg/admin/controller_test.go @@ -9,8 +9,7 @@ import ( "net/http" "net/http/httptest" - . "github.com/onsi/ginkgo" - . "github.com/onsi/ginkgo/extensions/table" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sirupsen/logrus/hooks/test" diff --git a/pkg/admin/http_over_uds_server_test.go b/pkg/admin/http_over_uds_server_test.go index 94344427ec..eabab7321d 100644 --- a/pkg/admin/http_over_uds_server_test.go +++ b/pkg/admin/http_over_uds_server_test.go @@ -9,7 +9,7 @@ import ( "os" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/admin" ) diff --git a/pkg/agent/agent_suite_test.go b/pkg/agent/agent_suite_test.go index ef6db6efd6..736071df55 100644 --- a/pkg/agent/agent_suite_test.go +++ b/pkg/agent/agent_suite_test.go @@ -3,7 +3,7 @@ package agent_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/dotnetspy/dotnetspy_suite_test.go b/pkg/agent/dotnetspy/dotnetspy_suite_test.go index 358ff004d8..ca0098d89b 100644 --- a/pkg/agent/dotnetspy/dotnetspy_suite_test.go +++ b/pkg/agent/dotnetspy/dotnetspy_suite_test.go @@ -1,3 +1,4 @@ +//go:build dotnetspy // +build dotnetspy package dotnetspy_test @@ -5,7 +6,7 @@ package dotnetspy_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/dotnetspy/dotnetspy_test.go b/pkg/agent/dotnetspy/dotnetspy_test.go index 7ccd579e0a..d65c0f239c 100644 --- a/pkg/agent/dotnetspy/dotnetspy_test.go +++ b/pkg/agent/dotnetspy/dotnetspy_test.go @@ -1,3 +1,4 @@ +//go:build dotnetspy // +build dotnetspy package dotnetspy @@ -5,7 +6,7 @@ package dotnetspy import ( "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/gospy/gospy_suite_test.go b/pkg/agent/gospy/gospy_suite_test.go index e3759236fd..a58fd7c31d 100644 --- a/pkg/agent/gospy/gospy_suite_test.go +++ b/pkg/agent/gospy/gospy_suite_test.go @@ -3,7 +3,7 @@ package gospy_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/gospy/gospy_test.go b/pkg/agent/gospy/gospy_test.go index 468e935a48..d483de26e5 100644 --- a/pkg/agent/gospy/gospy_test.go +++ b/pkg/agent/gospy/gospy_test.go @@ -4,7 +4,7 @@ import ( "log" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/agent/spy" "github.com/pyroscope-io/pyroscope/pkg/config" diff --git a/pkg/agent/profiler/profiler_suite_test.go b/pkg/agent/profiler/profiler_suite_test.go index e1f97d5be1..63548e97ba 100644 --- a/pkg/agent/profiler/profiler_suite_test.go +++ b/pkg/agent/profiler/profiler_suite_test.go @@ -3,7 +3,7 @@ package profiler_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/session_test.go b/pkg/agent/session_test.go index 4e20bbcb1c..9a4d9fcc9b 100644 --- a/pkg/agent/session_test.go +++ b/pkg/agent/session_test.go @@ -4,7 +4,7 @@ import ( "os" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/agent/spy" "github.com/pyroscope-io/pyroscope/pkg/agent/upstream" @@ -24,40 +24,45 @@ func (u *upstreamMock) Upload(j *upstream.UploadJob) { var _ = Describe("agent.Session", func() { Describe("NewSession", func() { - It("creates a new session and performs chunking", func(done Done) { - u := &upstreamMock{} - uploadRate := 200 * time.Millisecond - s, _ := NewSession(SessionConfig{ - Upstream: u, - AppName: "test-app", - ProfilingTypes: []spy.ProfileType{spy.ProfileCPU}, - SpyName: "debugspy", - SampleRate: 100, - UploadRate: uploadRate, - Pid: os.Getpid(), - WithSubprocesses: true, - Logger: logrus.StandardLogger(), - }) - now := time.Now() - time.Sleep(now.Truncate(uploadRate).Add(uploadRate + 10*time.Millisecond).Sub(now)) - err := s.Start() + It("creates a new session and performs chunking", func() { + done := make(chan interface{}) + go func() { + defer GinkgoRecover() + u := &upstreamMock{} + uploadRate := 200 * time.Millisecond + s, _ := NewSession(SessionConfig{ + Upstream: u, + AppName: "test-app", + ProfilingTypes: []spy.ProfileType{spy.ProfileCPU}, + SpyName: "debugspy", + SampleRate: 100, + UploadRate: uploadRate, + Pid: os.Getpid(), + WithSubprocesses: true, + Logger: logrus.StandardLogger(), + }) + now := time.Now() + time.Sleep(now.Truncate(uploadRate).Add(uploadRate + 10*time.Millisecond).Sub(now)) + err := s.Start() - Expect(err).ToNot(HaveOccurred()) - time.Sleep(500 * time.Millisecond) - s.Stop() + Expect(err).ToNot(HaveOccurred()) + time.Sleep(500 * time.Millisecond) + s.Stop() - Expect(u.uploads).To(HaveLen(3)) - u.uploads[0].Trie.Iterate(func(name []byte, val uint64) { - Expect(val).To(BeNumerically("~", 19, 2)) - }) - u.uploads[1].Trie.Iterate(func(name []byte, val uint64) { - Expect(val).To(BeNumerically("~", 20, 2)) - }) - u.uploads[2].Trie.Iterate(func(name []byte, val uint64) { - Expect(val).To(BeNumerically("~", 11, 2)) - }) - close(done) - Expect(u.uploads[0].Name).To(Equal("test-app.cpu{}")) + Expect(u.uploads).To(HaveLen(3)) + u.uploads[0].Trie.Iterate(func(name []byte, val uint64) { + Expect(val).To(BeNumerically("~", 19, 2)) + }) + u.uploads[1].Trie.Iterate(func(name []byte, val uint64) { + Expect(val).To(BeNumerically("~", 20, 2)) + }) + u.uploads[2].Trie.Iterate(func(name []byte, val uint64) { + Expect(val).To(BeNumerically("~", 11, 2)) + }) + close(done) + Expect(u.uploads[0].Name).To(Equal("test-app.cpu{}")) + }() + Eventually(done, 3).Should(BeClosed()) }) When("tags specified", func() { diff --git a/pkg/agent/spy/spy_suite_test.go b/pkg/agent/spy/spy_suite_test.go index 404763f7c8..ab011a4402 100644 --- a/pkg/agent/spy/spy_suite_test.go +++ b/pkg/agent/spy/spy_suite_test.go @@ -3,7 +3,7 @@ package spy_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/target/target_suite_test.go b/pkg/agent/target/target_suite_test.go index 2c80fbbf35..5bc477aba5 100644 --- a/pkg/agent/target/target_suite_test.go +++ b/pkg/agent/target/target_suite_test.go @@ -3,7 +3,7 @@ package target_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/target/target_test.go b/pkg/agent/target/target_test.go index faa4d3cfd2..4739303468 100644 --- a/pkg/agent/target/target_test.go +++ b/pkg/agent/target/target_test.go @@ -1,3 +1,4 @@ +//go:build debugspy // +build debugspy package target @@ -6,7 +7,7 @@ import ( "context" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" diff --git a/pkg/agent/upstream/direct/direct_suite_test.go b/pkg/agent/upstream/direct/direct_suite_test.go index c03f28e97a..6572e1c3d4 100644 --- a/pkg/agent/upstream/direct/direct_suite_test.go +++ b/pkg/agent/upstream/direct/direct_suite_test.go @@ -3,7 +3,7 @@ package direct_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/upstream/remote/remote_suite_test.go b/pkg/agent/upstream/remote/remote_suite_test.go index e55a1a8983..4df55faa36 100644 --- a/pkg/agent/upstream/remote/remote_suite_test.go +++ b/pkg/agent/upstream/remote/remote_suite_test.go @@ -3,7 +3,7 @@ package remote_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/agent/upstream/remote/remote_test.go b/pkg/agent/upstream/remote/remote_test.go index 8e6741ecac..739e719dc9 100644 --- a/pkg/agent/upstream/remote/remote_test.go +++ b/pkg/agent/upstream/remote/remote_test.go @@ -9,7 +9,7 @@ import ( "sync" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/agent/upstream" "github.com/pyroscope-io/pyroscope/pkg/structs/transporttrie" diff --git a/pkg/agent/upstream/upstream_suite_test.go b/pkg/agent/upstream/upstream_suite_test.go index e99cc34b75..8f893d01fc 100644 --- a/pkg/agent/upstream/upstream_suite_test.go +++ b/pkg/agent/upstream/upstream_suite_test.go @@ -3,7 +3,7 @@ package upstream_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/analytics/analytics_suite_test.go b/pkg/analytics/analytics_suite_test.go index 759cf77abd..af3cf62319 100644 --- a/pkg/analytics/analytics_suite_test.go +++ b/pkg/analytics/analytics_suite_test.go @@ -3,7 +3,7 @@ package analytics_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/analytics/analytics_test.go b/pkg/analytics/analytics_test.go index e2acf310a1..41d894e023 100644 --- a/pkg/analytics/analytics_test.go +++ b/pkg/analytics/analytics_test.go @@ -13,7 +13,7 @@ import ( "sync" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/pyroscope-io/pyroscope/pkg/health" diff --git a/pkg/api/api_key_test.go b/pkg/api/api_key_test.go index 2dcaaeb80a..c593e6802e 100644 --- a/pkg/api/api_key_test.go +++ b/pkg/api/api_key_test.go @@ -8,7 +8,7 @@ import ( "github.com/golang/mock/gomock" "github.com/hashicorp/go-multierror" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/api/mocks" diff --git a/pkg/api/api_suite_test.go b/pkg/api/api_suite_test.go index a987c7cd2a..1e99ec0368 100644 --- a/pkg/api/api_suite_test.go +++ b/pkg/api/api_suite_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/gorilla/mux" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" diff --git a/pkg/api/auth_test.go b/pkg/api/auth_test.go index 50fc042739..5fb9989292 100644 --- a/pkg/api/auth_test.go +++ b/pkg/api/auth_test.go @@ -5,7 +5,7 @@ import ( "net/http/httptest" "github.com/golang/mock/gomock" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" "github.com/pyroscope-io/pyroscope/pkg/api" "github.com/pyroscope-io/pyroscope/pkg/api/mocks" diff --git a/pkg/api/user_test.go b/pkg/api/user_test.go index 05b78d0fdb..a8b8fb3a5c 100644 --- a/pkg/api/user_test.go +++ b/pkg/api/user_test.go @@ -8,7 +8,7 @@ import ( "github.com/golang/mock/gomock" "github.com/hashicorp/go-multierror" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/api/mocks" diff --git a/pkg/build/build_suite_test.go b/pkg/build/build_suite_test.go index b51ab72d6c..78d6375a02 100644 --- a/pkg/build/build_suite_test.go +++ b/pkg/build/build_suite_test.go @@ -3,7 +3,7 @@ package build_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/cli/cli_suite_test.go b/pkg/cli/cli_suite_test.go index 757aaaee5e..e874cec3dd 100644 --- a/pkg/cli/cli_suite_test.go +++ b/pkg/cli/cli_suite_test.go @@ -6,7 +6,7 @@ package cli_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/cli/command_test.go b/pkg/cli/command_test.go index 5d768d0e4f..58f581f676 100644 --- a/pkg/cli/command_test.go +++ b/pkg/cli/command_test.go @@ -5,7 +5,7 @@ import ( "os" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" diff --git a/pkg/cli/flags_test.go b/pkg/cli/flags_test.go index 0ec9e3b4f8..ecd1a8c155 100644 --- a/pkg/cli/flags_test.go +++ b/pkg/cli/flags_test.go @@ -7,7 +7,7 @@ import ( "os" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/pkg/config/config_suite_test.go b/pkg/config/config_suite_test.go index c7d2e82ab5..c6e29ba716 100644 --- a/pkg/config/config_suite_test.go +++ b/pkg/config/config_suite_test.go @@ -3,7 +3,7 @@ package config_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/convert/convert_suite_test.go b/pkg/convert/convert_suite_test.go index d60ae6232e..573b79f2c9 100644 --- a/pkg/convert/convert_suite_test.go +++ b/pkg/convert/convert_suite_test.go @@ -3,7 +3,7 @@ package convert_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/convert/parser_test.go b/pkg/convert/parser_test.go index c1c9f2fd31..44e9337116 100644 --- a/pkg/convert/parser_test.go +++ b/pkg/convert/parser_test.go @@ -6,7 +6,7 @@ import ( "fmt" "os" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/agent/spy" ) diff --git a/pkg/exec/connect_test.go b/pkg/exec/connect_test.go index bf23427c8a..0299b4a332 100644 --- a/pkg/exec/connect_test.go +++ b/pkg/exec/connect_test.go @@ -1,10 +1,12 @@ +//go:build debugspy // +build debugspy + // ^ this test requires debugspy to be enabled so to run this test make sure to include -tags debugspy package exec import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/config" diff --git a/pkg/exec/exec_suite_test.go b/pkg/exec/exec_suite_test.go index 14296b72fc..a790fe85ab 100644 --- a/pkg/exec/exec_suite_test.go +++ b/pkg/exec/exec_suite_test.go @@ -3,7 +3,7 @@ package exec_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/exec/exec_test.go b/pkg/exec/exec_test.go index 0ecd4cad67..c40bc60008 100644 --- a/pkg/exec/exec_test.go +++ b/pkg/exec/exec_test.go @@ -1,10 +1,12 @@ +//go:build debugspy // +build debugspy + // ^ this test requires debugspy to be enabled so to run this test make sure to include -tags debugspy package exec import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/config" diff --git a/pkg/flameql/flameql_suite_test.go b/pkg/flameql/flameql_suite_test.go index 5d84ff31a7..2a7c6a060c 100644 --- a/pkg/flameql/flameql_suite_test.go +++ b/pkg/flameql/flameql_suite_test.go @@ -3,7 +3,7 @@ package flameql_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/flameql/flameql_test.go b/pkg/flameql/flameql_test.go index 9e9ba55e0a..15219eebae 100644 --- a/pkg/flameql/flameql_test.go +++ b/pkg/flameql/flameql_test.go @@ -3,7 +3,7 @@ package flameql import ( "errors" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/flameql/parse_test.go b/pkg/flameql/parse_test.go index 31a75887d3..4ce3a7c52f 100644 --- a/pkg/flameql/parse_test.go +++ b/pkg/flameql/parse_test.go @@ -5,7 +5,7 @@ import ( "regexp" "regexp/syntax" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/health/controller_test.go b/pkg/health/controller_test.go index ab107d6e1b..198eedd624 100644 --- a/pkg/health/controller_test.go +++ b/pkg/health/controller_test.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" diff --git a/pkg/health/health_suite_test.go b/pkg/health/health_suite_test.go index a6cf7ce593..4856db7513 100644 --- a/pkg/health/health_suite_test.go +++ b/pkg/health/health_suite_test.go @@ -3,7 +3,7 @@ package health_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/model/api_key_test.go b/pkg/model/api_key_test.go index 44854d3b5f..1e93fe8cf1 100644 --- a/pkg/model/api_key_test.go +++ b/pkg/model/api_key_test.go @@ -4,8 +4,7 @@ import ( "strings" "github.com/hashicorp/go-multierror" - . "github.com/onsi/ginkgo" - . "github.com/onsi/ginkgo/extensions/table" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/model" diff --git a/pkg/model/model_suite_test.go b/pkg/model/model_suite_test.go index 7ad3e36f52..15220bf267 100644 --- a/pkg/model/model_suite_test.go +++ b/pkg/model/model_suite_test.go @@ -3,7 +3,7 @@ package model_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/model/role_test.go b/pkg/model/role_test.go index dfd6e14eb3..be9cb93fe5 100644 --- a/pkg/model/role_test.go +++ b/pkg/model/role_test.go @@ -3,8 +3,7 @@ package model_test import ( "encoding/json" - . "github.com/onsi/ginkgo" - . "github.com/onsi/ginkgo/extensions/table" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/model" diff --git a/pkg/model/user_test.go b/pkg/model/user_test.go index acef640c89..277fc587fa 100644 --- a/pkg/model/user_test.go +++ b/pkg/model/user_test.go @@ -4,8 +4,7 @@ import ( "strings" "github.com/hashicorp/go-multierror" - . "github.com/onsi/ginkgo" - . "github.com/onsi/ginkgo/extensions/table" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/model" diff --git a/pkg/server/build_test.go b/pkg/server/build_test.go index ba9475b594..fb0055813d 100644 --- a/pkg/server/build_test.go +++ b/pkg/server/build_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "runtime" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/pkg/server/config_test.go b/pkg/server/config_test.go index 096c296de0..4529bb700e 100644 --- a/pkg/server/config_test.go +++ b/pkg/server/config_test.go @@ -6,7 +6,7 @@ import ( "net/http" "net/http/httptest" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/pkg/server/controller_gzip_test.go b/pkg/server/controller_gzip_test.go index 945ee34dc3..fbc8af5312 100644 --- a/pkg/server/controller_gzip_test.go +++ b/pkg/server/controller_gzip_test.go @@ -7,8 +7,7 @@ import ( "os" "path/filepath" - . "github.com/onsi/ginkgo" - . "github.com/onsi/ginkgo/extensions/table" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" @@ -22,18 +21,21 @@ import ( const assetAtCompressionThreshold, assetLtCompressionThreshold = "AssetAtCompressionThreshold", "AssetLTCompressionThreshold" +var tempAssetDir *testing.TmpDirectory + +var _ = BeforeSuite(func() { + tempAssetDir = testing.TmpDirSync() + os.Mkdir(filepath.Join(tempAssetDir.Path, "assets"), 0755) + os.WriteFile(filepath.Join(tempAssetDir.Path, "assets", assetLtCompressionThreshold), make([]byte, gzHTTPCompressionThreshold-1), 0644) + os.WriteFile(filepath.Join(tempAssetDir.Path, "assets", assetAtCompressionThreshold), make([]byte, gzHTTPCompressionThreshold), 0644) +}) + +var _ =AfterSuite(func() { + tempAssetDir.Close() +}) + var _ = Describe("server", func() { testing.WithConfig(func(cfg **config.Config) { - var tempAssetDir *testing.TmpDirectory - BeforeSuite(func() { - tempAssetDir = testing.TmpDirSync() - os.Mkdir(filepath.Join(tempAssetDir.Path, "assets"), 0755) - os.WriteFile(filepath.Join(tempAssetDir.Path, "assets", assetLtCompressionThreshold), make([]byte, gzHTTPCompressionThreshold-1), 0644) - os.WriteFile(filepath.Join(tempAssetDir.Path, "assets", assetAtCompressionThreshold), make([]byte, gzHTTPCompressionThreshold), 0644) - }) - AfterSuite(func() { - tempAssetDir.Close() - }) DescribeTable("compress assets", func(filename string, uncompressed bool) { done := make(chan interface{}) diff --git a/pkg/server/controller_https_test.go b/pkg/server/controller_https_test.go index 74ba06ff4b..c85437c305 100644 --- a/pkg/server/controller_https_test.go +++ b/pkg/server/controller_https_test.go @@ -7,7 +7,7 @@ import ( "path/filepath" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/pkg/server/ingest_test.go b/pkg/server/ingest_test.go index bea73c8881..7ab9127cd0 100644 --- a/pkg/server/ingest_test.go +++ b/pkg/server/ingest_test.go @@ -8,7 +8,7 @@ import ( "net/url" "strconv" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/pkg/server/render_test.go b/pkg/server/render_test.go index e64e43550f..99c180d2bc 100644 --- a/pkg/server/render_test.go +++ b/pkg/server/render_test.go @@ -10,7 +10,7 @@ import ( "net/url" "github.com/golang/protobuf/proto" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/pkg/server/server_suite_test.go b/pkg/server/server_suite_test.go index 4b33ad3c5c..abee90eba0 100644 --- a/pkg/server/server_suite_test.go +++ b/pkg/server/server_suite_test.go @@ -6,7 +6,7 @@ package server_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/service/api_key_test.go b/pkg/service/api_key_test.go index 71ac47192f..8667a77e13 100644 --- a/pkg/service/api_key_test.go +++ b/pkg/service/api_key_test.go @@ -4,7 +4,7 @@ import ( "context" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/model" diff --git a/pkg/service/jwt_token_test.go b/pkg/service/jwt_token_test.go index 99016779cb..916f7ec67d 100644 --- a/pkg/service/jwt_token_test.go +++ b/pkg/service/jwt_token_test.go @@ -4,7 +4,7 @@ import ( "time" "github.com/golang-jwt/jwt" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/model" diff --git a/pkg/service/service_suite_test.go b/pkg/service/service_suite_test.go index 2a364da90e..b3d922b571 100644 --- a/pkg/service/service_suite_test.go +++ b/pkg/service/service_suite_test.go @@ -3,7 +3,7 @@ package service_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/service/user_test.go b/pkg/service/user_test.go index 77c2baf5eb..d0b0cd4fd9 100644 --- a/pkg/service/user_test.go +++ b/pkg/service/user_test.go @@ -3,7 +3,7 @@ package service_test import ( "context" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/model" diff --git a/pkg/storage/cache/cache_suite_test.go b/pkg/storage/cache/cache_suite_test.go index 86e83bfbe0..f9503ab204 100644 --- a/pkg/storage/cache/cache_suite_test.go +++ b/pkg/storage/cache/cache_suite_test.go @@ -3,7 +3,7 @@ package cache_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/cache/cache_test.go b/pkg/storage/cache/cache_test.go index 5c95dcf2b4..b8a88bb6e5 100644 --- a/pkg/storage/cache/cache_test.go +++ b/pkg/storage/cache/cache_test.go @@ -11,7 +11,7 @@ import ( "github.com/dgraph-io/badger/v2" "github.com/dgraph-io/badger/v2/options" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" @@ -28,58 +28,62 @@ func (fakeCodec) Serialize(_ io.Writer, _ string, _ interface{}) error { return func (fakeCodec) Deserialize(_ io.Reader, _ string) (interface{}, error) { return nil, nil } var _ = Describe("cache", func() { - It("works properly", func(done Done) { - tdir := testing.TmpDirSync() - badgerPath := filepath.Join(tdir.Path) - err := os.MkdirAll(badgerPath, 0o755) - Expect(err).ToNot(HaveOccurred()) - - badgerOptions := badger.DefaultOptions(badgerPath) - badgerOptions = badgerOptions.WithTruncate(false) - badgerOptions = badgerOptions.WithSyncWrites(false) - badgerOptions = badgerOptions.WithCompression(options.ZSTD) - - db, err := badger.Open(badgerOptions) - Expect(err).ToNot(HaveOccurred()) - - reg := prometheus.NewRegistry() - cache := New(Config{ - DB: db, - Codec: fakeCodec{}, - Prefix: "p:", - Metrics: &Metrics{ - MissesCounter: promauto.With(reg).NewCounter(prometheus.CounterOpts{ - Name: "cache_test_miss", - }), - ReadsCounter: promauto.With(reg).NewCounter(prometheus.CounterOpts{ - Name: "storage_test_read", - }), - DBWrites: promauto.With(reg).NewHistogram(prometheus.HistogramOpts{ - Name: "storage_test_write", - }), - DBReads: promauto.With(reg).NewHistogram(prometheus.HistogramOpts{ - Name: "storage_test_reads", - }), - }, - }) - - for i := 0; i < 200; i++ { - cache.Put(fmt.Sprintf("foo-%d", i), fmt.Sprintf("bar-%d", i)) - } - - v, err := cache.GetOrCreate("foo-199") - Expect(err).ToNot(HaveOccurred()) - Expect(v).To(Equal("bar-199")) - - v, err = cache.GetOrCreate("foo-1") - Expect(err).ToNot(HaveOccurred()) - Expect(v).To(Equal("bar-1")) - - v, err = cache.GetOrCreate("foo-1234") - Expect(err).ToNot(HaveOccurred()) - Expect(v).To(Equal("foo-1234")) - cache.Flush() - - close(done) - }, 3) + It("works properly", func() { + done := make(chan interface{}) + go func() { + tdir := testing.TmpDirSync() + badgerPath := filepath.Join(tdir.Path) + err := os.MkdirAll(badgerPath, 0o755) + Expect(err).ToNot(HaveOccurred()) + + badgerOptions := badger.DefaultOptions(badgerPath) + badgerOptions = badgerOptions.WithTruncate(false) + badgerOptions = badgerOptions.WithSyncWrites(false) + badgerOptions = badgerOptions.WithCompression(options.ZSTD) + + db, err := badger.Open(badgerOptions) + Expect(err).ToNot(HaveOccurred()) + + reg := prometheus.NewRegistry() + cache := New(Config{ + DB: db, + Codec: fakeCodec{}, + Prefix: "p:", + Metrics: &Metrics{ + MissesCounter: promauto.With(reg).NewCounter(prometheus.CounterOpts{ + Name: "cache_test_miss", + }), + ReadsCounter: promauto.With(reg).NewCounter(prometheus.CounterOpts{ + Name: "storage_test_read", + }), + DBWrites: promauto.With(reg).NewHistogram(prometheus.HistogramOpts{ + Name: "storage_test_write", + }), + DBReads: promauto.With(reg).NewHistogram(prometheus.HistogramOpts{ + Name: "storage_test_reads", + }), + }, + }) + + for i := 0; i < 200; i++ { + cache.Put(fmt.Sprintf("foo-%d", i), fmt.Sprintf("bar-%d", i)) + } + + v, err := cache.GetOrCreate("foo-199") + Expect(err).ToNot(HaveOccurred()) + Expect(v).To(Equal("bar-199")) + + v, err = cache.GetOrCreate("foo-1") + Expect(err).ToNot(HaveOccurred()) + Expect(v).To(Equal("bar-1")) + + v, err = cache.GetOrCreate("foo-1234") + Expect(err).ToNot(HaveOccurred()) + Expect(v).To(Equal("foo-1234")) + cache.Flush() + + close(done) + }() + Eventually(done, 3).Should(BeClosed()) + }) }) diff --git a/pkg/storage/config_test.go b/pkg/storage/config_test.go index 6307d0383e..32a76cdbc2 100644 --- a/pkg/storage/config_test.go +++ b/pkg/storage/config_test.go @@ -3,7 +3,7 @@ package storage import ( "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" diff --git a/pkg/storage/dict/dict_suite_test.go b/pkg/storage/dict/dict_suite_test.go index 27a6078c7a..845f35cc32 100644 --- a/pkg/storage/dict/dict_suite_test.go +++ b/pkg/storage/dict/dict_suite_test.go @@ -3,7 +3,7 @@ package dict_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" testing2 "github.com/pyroscope-io/pyroscope/pkg/testing" ) diff --git a/pkg/storage/dict/dict_test.go b/pkg/storage/dict/dict_test.go index e3df8b61f6..f6ac517f33 100644 --- a/pkg/storage/dict/dict_test.go +++ b/pkg/storage/dict/dict_test.go @@ -3,7 +3,7 @@ package dict import ( "math/rand" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/dict/serialize_test.go b/pkg/storage/dict/serialize_test.go index 604f7064c2..e8f3c1e50c 100644 --- a/pkg/storage/dict/serialize_test.go +++ b/pkg/storage/dict/serialize_test.go @@ -3,7 +3,7 @@ package dict import ( "bytes" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/dimension/dimension_suite_test.go b/pkg/storage/dimension/dimension_suite_test.go index 6fc6cecd66..b0c03d0e96 100644 --- a/pkg/storage/dimension/dimension_suite_test.go +++ b/pkg/storage/dimension/dimension_suite_test.go @@ -3,7 +3,7 @@ package dimension_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/dimension/dimension_test.go b/pkg/storage/dimension/dimension_test.go index 82b6c7d174..8726e554a7 100644 --- a/pkg/storage/dimension/dimension_test.go +++ b/pkg/storage/dimension/dimension_test.go @@ -1,7 +1,7 @@ package dimension import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/labels/labels_suite_test.go b/pkg/storage/labels/labels_suite_test.go index 0ab7ef32c7..9faecaa9c2 100644 --- a/pkg/storage/labels/labels_suite_test.go +++ b/pkg/storage/labels/labels_suite_test.go @@ -3,7 +3,7 @@ package labels_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/segment/fuzz_test.go b/pkg/storage/segment/fuzz_test.go index a3048bd183..63902350b8 100644 --- a/pkg/storage/segment/fuzz_test.go +++ b/pkg/storage/segment/fuzz_test.go @@ -6,7 +6,7 @@ import ( "math/rand" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/testing" ) @@ -128,21 +128,29 @@ func fuzzTest(testWrites bool, writeSize func() int) { var _ = Describe("segment", func() { Context("fuzz tests", func() { Context("writes are 10 second long", func() { - It("works as expected", func(done Done) { - fuzzTest(true, func() int { - return 10 - }) - close(done) - }, 5) + It("works as expected", func() { + done := make(chan interface{}) + go func() { + fuzzTest(true, func() int { + return 10 + }) + close(done) + }() + Eventually(done, 5).Should(BeClosed()) + }) }) Context("writes are different lengths", func() { - It("works as expected", func(done Done) { - fuzzTest(false, func() int { - return 20 - // return 1 + rand.Intn(10)*10 - }) - close(done) - }, 5) + It("works as expected", func() { + done := make(chan interface{}) + go func() { + fuzzTest(false, func() int { + return 20 + // return 1 + rand.Intn(10)*10 + }) + close(done) + }() + Eventually(done, 5).Should(BeClosed()) + }) }) }) }) diff --git a/pkg/storage/segment/key_test.go b/pkg/storage/segment/key_test.go index 200fc56271..a1a3be3264 100644 --- a/pkg/storage/segment/key_test.go +++ b/pkg/storage/segment/key_test.go @@ -1,7 +1,7 @@ package segment import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/flameql" diff --git a/pkg/storage/segment/overlap_test.go b/pkg/storage/segment/overlap_test.go index e221992170..0511143d35 100644 --- a/pkg/storage/segment/overlap_test.go +++ b/pkg/storage/segment/overlap_test.go @@ -4,7 +4,7 @@ import ( "math/big" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/testing" ) diff --git a/pkg/storage/segment/relationship_test.go b/pkg/storage/segment/relationship_test.go index 6b6461fb0d..00dffcc80b 100644 --- a/pkg/storage/segment/relationship_test.go +++ b/pkg/storage/segment/relationship_test.go @@ -1,7 +1,7 @@ package segment import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/testing" ) diff --git a/pkg/storage/segment/segment_suite_test.go b/pkg/storage/segment/segment_suite_test.go index 583d4fe801..2b4e9e67c5 100644 --- a/pkg/storage/segment/segment_suite_test.go +++ b/pkg/storage/segment/segment_suite_test.go @@ -3,7 +3,7 @@ package segment_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/segment/segment_test.go b/pkg/storage/segment/segment_test.go index d3ec5b04e7..b776aee186 100644 --- a/pkg/storage/segment/segment_test.go +++ b/pkg/storage/segment/segment_test.go @@ -9,7 +9,7 @@ import ( "strings" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/testing" diff --git a/pkg/storage/segment/serialization_test.go b/pkg/storage/segment/serialization_test.go index 74c516557d..49776087ae 100644 --- a/pkg/storage/segment/serialization_test.go +++ b/pkg/storage/segment/serialization_test.go @@ -6,7 +6,7 @@ import ( "math/big" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/testing" ) diff --git a/pkg/storage/segment/timeline_test.go b/pkg/storage/segment/timeline_test.go index 74d2f05d39..543936fae4 100644 --- a/pkg/storage/segment/timeline_test.go +++ b/pkg/storage/segment/timeline_test.go @@ -4,7 +4,7 @@ import ( "math/big" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/testing" ) @@ -42,25 +42,29 @@ var _ = Describe("timeline", func() { }) }) Context("one level", func() { - It("works as expected", func(done Done) { - s := New() - s.Put(testing.SimpleTime(0), - testing.SimpleTime(9), 2, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - s.Put(testing.SimpleTime(10), - testing.SimpleTime(19), 5, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - s.Put(testing.SimpleTime(20), - testing.SimpleTime(29), 0, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - - timeline.PopulateTimeline(s) - Expect(timeline.Samples).To(Equal([]uint64{ - 3, - 6, - 1, - 0, - })) - - close(done) - }, 5) + It("works as expected", func() { + done := make(chan interface{}) + go func() { + s := New() + s.Put(testing.SimpleTime(0), + testing.SimpleTime(9), 2, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + s.Put(testing.SimpleTime(10), + testing.SimpleTime(19), 5, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + s.Put(testing.SimpleTime(20), + testing.SimpleTime(29), 0, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + + timeline.PopulateTimeline(s) + Expect(timeline.Samples).To(Equal([]uint64{ + 3, + 6, + 1, + 0, + })) + + close(done) + }() + Eventually(done, 5).Should(BeClosed()) + }) }) Context("multiple Levels", func() { BeforeEach(func() { @@ -68,22 +72,26 @@ var _ = Describe("timeline", func() { et = 365 * 24 * 60 * 60 }) - It("works as expected", func(done Done) { - s := New() - s.Put(testing.SimpleTime(0), - testing.SimpleTime(9), 2, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - s.Put(testing.SimpleTime(10), - testing.SimpleTime(19), 5, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - s.Put(testing.SimpleTime(20), - testing.SimpleTime(29), 0, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - - timeline.PopulateTimeline(s) - expected := make([]uint64, 3153) - expected[0] = 8 - Expect(timeline.Samples).To(Equal(expected)) - - close(done) - }, 5) + It("works as expected", func() { + done := make(chan interface{}) + go func() { + s := New() + s.Put(testing.SimpleTime(0), + testing.SimpleTime(9), 2, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + s.Put(testing.SimpleTime(10), + testing.SimpleTime(19), 5, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + s.Put(testing.SimpleTime(20), + testing.SimpleTime(29), 0, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + + timeline.PopulateTimeline(s) + expected := make([]uint64, 3153) + expected[0] = 8 + Expect(timeline.Samples).To(Equal(expected)) + + close(done) + }() + Eventually(done, 5).Should(BeClosed()) + }) }) Context("with threshold", func() { @@ -92,31 +100,35 @@ var _ = Describe("timeline", func() { et = 365 * 24 * 60 * 60 }) - It("removed nodes are down-sampled", func(done Done) { - s := New() - now := time.Now() - s.Put(testing.SimpleTime(0), - testing.SimpleTime(9), 2, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - s.Put(testing.SimpleTime(10), - testing.SimpleTime(19), 5, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - - // To prevent segment root removal. - s.Put(now.Add(-10*time.Second), - now, 0, func(de int, t time.Time, r *big.Rat, a []Addon) {}) - - threshold := NewRetentionPolicy(). - SetLevelPeriod(0, time.Second). - SetLevelPeriod(1, time.Minute) - - _, err := s.DeleteNodesBefore(threshold) - Expect(err).ToNot(HaveOccurred()) - timeline.PopulateTimeline(s) - expected := make([]uint64, 3153) - expected[0] = 8 - Expect(timeline.Samples).To(Equal(expected)) - - close(done) - }, 5) + It("removed nodes are down-sampled", func() { + done := make(chan interface{}) + go func() { + s := New() + now := time.Now() + s.Put(testing.SimpleTime(0), + testing.SimpleTime(9), 2, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + s.Put(testing.SimpleTime(10), + testing.SimpleTime(19), 5, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + + // To prevent segment root removal. + s.Put(now.Add(-10*time.Second), + now, 0, func(de int, t time.Time, r *big.Rat, a []Addon) {}) + + threshold := NewRetentionPolicy(). + SetLevelPeriod(0, time.Second). + SetLevelPeriod(1, time.Minute) + + _, err := s.DeleteNodesBefore(threshold) + Expect(err).ToNot(HaveOccurred()) + timeline.PopulateTimeline(s) + expected := make([]uint64, 3153) + expected[0] = 8 + Expect(timeline.Samples).To(Equal(expected)) + + close(done) + }() + Eventually(done, 5).Should(BeClosed()) + }) }) }) }) diff --git a/pkg/storage/storage_delete_test.go b/pkg/storage/storage_delete_test.go index 4154a4e33e..54f467885b 100644 --- a/pkg/storage/storage_delete_test.go +++ b/pkg/storage/storage_delete_test.go @@ -3,7 +3,7 @@ package storage import ( "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" diff --git a/pkg/storage/storage_suite_test.go b/pkg/storage/storage_suite_test.go index 71b90f597a..b071f31988 100644 --- a/pkg/storage/storage_suite_test.go +++ b/pkg/storage/storage_suite_test.go @@ -3,7 +3,7 @@ package storage_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" testutils "github.com/pyroscope-io/pyroscope/pkg/testing" ) diff --git a/pkg/storage/storage_test.go b/pkg/storage/storage_test.go index 6b6cee0cd8..6ff6b5c884 100644 --- a/pkg/storage/storage_test.go +++ b/pkg/storage/storage_test.go @@ -9,7 +9,7 @@ import ( "strconv" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/prometheus/client_golang/prometheus" "github.com/shirou/gopsutil/mem" diff --git a/pkg/storage/tree/flamebearer_test.go b/pkg/storage/tree/flamebearer_test.go index 0c455a2d5f..a21d72bf03 100644 --- a/pkg/storage/tree/flamebearer_test.go +++ b/pkg/storage/tree/flamebearer_test.go @@ -4,7 +4,7 @@ import ( "fmt" "math/rand" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2/dsl/core" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/tree/pprof_test.go b/pkg/storage/tree/pprof_test.go index acd2a8eb0f..aa2e49f236 100644 --- a/pkg/storage/tree/pprof_test.go +++ b/pkg/storage/tree/pprof_test.go @@ -3,7 +3,7 @@ package tree import ( "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2/dsl/core" . "github.com/onsi/gomega" "google.golang.org/protobuf/proto" ) diff --git a/pkg/storage/tree/profile_finder_test.go b/pkg/storage/tree/profile_finder_test.go index d0c237c83f..54163e8210 100644 --- a/pkg/storage/tree/profile_finder_test.go +++ b/pkg/storage/tree/profile_finder_test.go @@ -1,7 +1,7 @@ package tree import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2/dsl/core" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/tree/serialize_nodict_test.go b/pkg/storage/tree/serialize_nodict_test.go index cd5ca9e226..ba31338895 100644 --- a/pkg/storage/tree/serialize_nodict_test.go +++ b/pkg/storage/tree/serialize_nodict_test.go @@ -3,7 +3,7 @@ package tree import ( "bytes" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2/dsl/core" . "github.com/onsi/gomega" ) diff --git a/pkg/storage/tree/serialize_test.go b/pkg/storage/tree/serialize_test.go index 71d79a5f0a..a4a2c68086 100644 --- a/pkg/storage/tree/serialize_test.go +++ b/pkg/storage/tree/serialize_test.go @@ -3,7 +3,7 @@ package tree import ( "bytes" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2/dsl/core" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/storage/dict" ) diff --git a/pkg/storage/tree/tree_suite_test.go b/pkg/storage/tree/tree_suite_test.go index 3dc4956fe8..dd2e6b7831 100644 --- a/pkg/storage/tree/tree_suite_test.go +++ b/pkg/storage/tree/tree_suite_test.go @@ -3,7 +3,7 @@ package tree_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2/dsl/core" . "github.com/onsi/gomega" testing2 "github.com/pyroscope-io/pyroscope/pkg/testing" ) diff --git a/pkg/storage/tree/tree_test.go b/pkg/storage/tree/tree_test.go index 1c820d29ef..46f61af282 100644 --- a/pkg/storage/tree/tree_test.go +++ b/pkg/storage/tree/tree_test.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2/dsl/core" . "github.com/onsi/gomega" "github.com/onsi/gomega/format" ) diff --git a/pkg/storage/tree/treediff_test.go b/pkg/storage/tree/treediff_test.go index 7e70d62e70..8694875b4a 100644 --- a/pkg/storage/tree/treediff_test.go +++ b/pkg/storage/tree/treediff_test.go @@ -4,7 +4,7 @@ import ( "fmt" "math/rand" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2/dsl/core" . "github.com/onsi/gomega" ) diff --git a/pkg/structs/cappedarr/cappedarr_suite_test.go b/pkg/structs/cappedarr/cappedarr_suite_test.go index 34d1f752a5..2ad0fbc069 100644 --- a/pkg/structs/cappedarr/cappedarr_suite_test.go +++ b/pkg/structs/cappedarr/cappedarr_suite_test.go @@ -3,7 +3,7 @@ package cappedarr_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/structs/cappedarr/cappedarr_test.go b/pkg/structs/cappedarr/cappedarr_test.go index 1252abba2c..967ed86220 100644 --- a/pkg/structs/cappedarr/cappedarr_test.go +++ b/pkg/structs/cappedarr/cappedarr_test.go @@ -4,7 +4,7 @@ import ( "math/rand" "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/structs/flamebearer/flamebearer_suite_test.go b/pkg/structs/flamebearer/flamebearer_suite_test.go index a6a44edc02..d29d3eae00 100644 --- a/pkg/structs/flamebearer/flamebearer_suite_test.go +++ b/pkg/structs/flamebearer/flamebearer_suite_test.go @@ -3,7 +3,7 @@ package flamebearer_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" testing2 "github.com/pyroscope-io/pyroscope/pkg/testing" ) diff --git a/pkg/structs/flamebearer/flamebearer_test.go b/pkg/structs/flamebearer/flamebearer_test.go index fd64282cad..42f76cd058 100644 --- a/pkg/structs/flamebearer/flamebearer_test.go +++ b/pkg/structs/flamebearer/flamebearer_test.go @@ -1,7 +1,7 @@ package flamebearer import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/storage" diff --git a/pkg/structs/merge/merge_suite_test.go b/pkg/structs/merge/merge_suite_test.go index e112efd1cc..4e3c984450 100644 --- a/pkg/structs/merge/merge_suite_test.go +++ b/pkg/structs/merge/merge_suite_test.go @@ -3,7 +3,7 @@ package merge_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/structs/sortedmap/sortedmap_suite_test.go b/pkg/structs/sortedmap/sortedmap_suite_test.go index b298d84021..f93229071f 100644 --- a/pkg/structs/sortedmap/sortedmap_suite_test.go +++ b/pkg/structs/sortedmap/sortedmap_suite_test.go @@ -3,7 +3,7 @@ package sortedmap_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/structs/transporttrie/diff_test.go b/pkg/structs/transporttrie/diff_test.go index e4c7d58b6e..91c3d6d7b4 100644 --- a/pkg/structs/transporttrie/diff_test.go +++ b/pkg/structs/transporttrie/diff_test.go @@ -1,7 +1,7 @@ package transporttrie import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/structs/transporttrie/merge_test.go b/pkg/structs/transporttrie/merge_test.go index 841fb5e381..fbcd518b44 100644 --- a/pkg/structs/transporttrie/merge_test.go +++ b/pkg/structs/transporttrie/merge_test.go @@ -5,7 +5,7 @@ import ( "github.com/sirupsen/logrus" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/structs/transporttrie/transporttrie_suite_test.go b/pkg/structs/transporttrie/transporttrie_suite_test.go index e1a5ce4782..b2d9b512ce 100644 --- a/pkg/structs/transporttrie/transporttrie_suite_test.go +++ b/pkg/structs/transporttrie/transporttrie_suite_test.go @@ -3,7 +3,7 @@ package transporttrie_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/structs/transporttrie/trie_test.go b/pkg/structs/transporttrie/trie_test.go index 6428cad0e2..19fcfa4cd7 100644 --- a/pkg/structs/transporttrie/trie_test.go +++ b/pkg/structs/transporttrie/trie_test.go @@ -7,7 +7,7 @@ import ( "hash/fnv" "math/rand" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" diff --git a/pkg/testing/config.go b/pkg/testing/config.go index e31413c0b3..9e71fab258 100644 --- a/pkg/testing/config.go +++ b/pkg/testing/config.go @@ -1,7 +1,7 @@ package testing import ( - "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/v2" "github.com/pyroscope-io/pyroscope/pkg/config" ) diff --git a/pkg/testing/tmpdir.go b/pkg/testing/tmpdir.go index 536c1e6a58..65d1f8338b 100644 --- a/pkg/testing/tmpdir.go +++ b/pkg/testing/tmpdir.go @@ -4,7 +4,7 @@ import ( "os" "path/filepath" - "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/v2" "github.com/pyroscope-io/pyroscope/pkg/util/bytesize" ) diff --git a/pkg/util/attime/attime_suite_test.go b/pkg/util/attime/attime_suite_test.go index 18eb0c72c5..960c499949 100644 --- a/pkg/util/attime/attime_suite_test.go +++ b/pkg/util/attime/attime_suite_test.go @@ -3,7 +3,7 @@ package attime_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/attime/attime_test.go b/pkg/util/attime/attime_test.go index 82ce6a78a7..5968ab5707 100644 --- a/pkg/util/attime/attime_test.go +++ b/pkg/util/attime/attime_test.go @@ -3,7 +3,7 @@ package attime import ( "time" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/bytesize/bytesize_suite_test.go b/pkg/util/bytesize/bytesize_suite_test.go index 667ce254c3..c7ec9ad76e 100644 --- a/pkg/util/bytesize/bytesize_suite_test.go +++ b/pkg/util/bytesize/bytesize_suite_test.go @@ -3,7 +3,7 @@ package bytesize_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/bytesize/bytesize_test.go b/pkg/util/bytesize/bytesize_test.go index 19c093171f..88fe84d892 100644 --- a/pkg/util/bytesize/bytesize_test.go +++ b/pkg/util/bytesize/bytesize_test.go @@ -1,7 +1,7 @@ package bytesize import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/caps/caps_suite_test.go b/pkg/util/caps/caps_suite_test.go index 48f9d483f8..fd21932e25 100644 --- a/pkg/util/caps/caps_suite_test.go +++ b/pkg/util/caps/caps_suite_test.go @@ -3,7 +3,7 @@ package caps_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/disk/disk_suite_test.go b/pkg/util/disk/disk_suite_test.go index ede118b66d..76bd860ee4 100644 --- a/pkg/util/disk/disk_suite_test.go +++ b/pkg/util/disk/disk_suite_test.go @@ -3,7 +3,7 @@ package disk_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/disk/usage_test.go b/pkg/util/disk/usage_test.go index 3186c601b6..ed21918d56 100644 --- a/pkg/util/disk/usage_test.go +++ b/pkg/util/disk/usage_test.go @@ -1,7 +1,7 @@ package disk import ( - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/pyroscope-io/pyroscope/pkg/config" diff --git a/pkg/util/file/file_suite_test.go b/pkg/util/file/file_suite_test.go index e8f172bf33..46afb4ea54 100644 --- a/pkg/util/file/file_suite_test.go +++ b/pkg/util/file/file_suite_test.go @@ -3,7 +3,7 @@ package file_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/hyperloglog/hyperloglog_suite_test.go b/pkg/util/hyperloglog/hyperloglog_suite_test.go index 7dab437a56..1761d56007 100644 --- a/pkg/util/hyperloglog/hyperloglog_suite_test.go +++ b/pkg/util/hyperloglog/hyperloglog_suite_test.go @@ -3,7 +3,7 @@ package hyperloglog_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/hyperloglog/hyperloglog_test.go b/pkg/util/hyperloglog/hyperloglog_test.go index 988588db69..83a8d4775a 100644 --- a/pkg/util/hyperloglog/hyperloglog_test.go +++ b/pkg/util/hyperloglog/hyperloglog_test.go @@ -3,7 +3,7 @@ package hyperloglog_test import ( "sync" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" wrapper "github.com/pyroscope-io/pyroscope/pkg/util/hyperloglog" "github.com/twmb/murmur3" diff --git a/pkg/util/id/id_suite_test.go b/pkg/util/id/id_suite_test.go index c4015d51c3..2b325af081 100644 --- a/pkg/util/id/id_suite_test.go +++ b/pkg/util/id/id_suite_test.go @@ -3,7 +3,7 @@ package id_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/names/names_suite_test.go b/pkg/util/names/names_suite_test.go index 381051f399..1e6238328b 100644 --- a/pkg/util/names/names_suite_test.go +++ b/pkg/util/names/names_suite_test.go @@ -3,7 +3,7 @@ package names_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/serialization/metadata_test.go b/pkg/util/serialization/metadata_test.go index 80942a4df7..5aa71c8599 100644 --- a/pkg/util/serialization/metadata_test.go +++ b/pkg/util/serialization/metadata_test.go @@ -4,7 +4,7 @@ import ( "bufio" "bytes" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/serialization/serialization_suite_test.go b/pkg/util/serialization/serialization_suite_test.go index fe105adee4..b933e64613 100644 --- a/pkg/util/serialization/serialization_suite_test.go +++ b/pkg/util/serialization/serialization_suite_test.go @@ -3,7 +3,7 @@ package serialization_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/slices/slices_suite_test.go b/pkg/util/slices/slices_suite_test.go index bc51a0f9d7..5465b3172c 100644 --- a/pkg/util/slices/slices_suite_test.go +++ b/pkg/util/slices/slices_suite_test.go @@ -3,7 +3,7 @@ package slices_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/util/varint/varint_suite_test.go b/pkg/util/varint/varint_suite_test.go index 3f89044ed0..3985388ed6 100644 --- a/pkg/util/varint/varint_suite_test.go +++ b/pkg/util/varint/varint_suite_test.go @@ -3,7 +3,7 @@ package varint_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pyroscope_suite_test.go b/pyroscope_suite_test.go index 7847840e0d..9c638283da 100644 --- a/pyroscope_suite_test.go +++ b/pyroscope_suite_test.go @@ -3,7 +3,7 @@ package pyroscope_test import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/scripts/decode-resp/decode_suite_test.go b/scripts/decode-resp/decode_suite_test.go index 14f9b80c97..c31e57b3e4 100644 --- a/scripts/decode-resp/decode_suite_test.go +++ b/scripts/decode-resp/decode_suite_test.go @@ -3,7 +3,7 @@ package main import ( "testing" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" testing2 "github.com/pyroscope-io/pyroscope/pkg/testing" ) diff --git a/scripts/decode-resp/decode_test.go b/scripts/decode-resp/decode_test.go index 0a1cb771d6..495033bfbb 100644 --- a/scripts/decode-resp/decode_test.go +++ b/scripts/decode-resp/decode_test.go @@ -7,7 +7,7 @@ import ( "github.com/pyroscope-io/pyroscope/pkg/storage/tree" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/tools/tools.go b/tools/tools.go index fc0c22db45..0493ee061a 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -16,7 +16,7 @@ import ( _ "github.com/kyoh86/richgo" _ "github.com/mattn/goreman" _ "github.com/mgechev/revive" - _ "github.com/onsi/ginkgo/ginkgo" + _ "github.com/onsi/ginkgo/v2/ginkgo" _ "golang.org/x/tools/cmd/godoc" _ "honnef.co/go/tools/cmd/staticcheck" )