diff --git a/gexec/build_test.go b/gexec/build_test.go index da3be94b0..b5dc9ea8f 100644 --- a/gexec/build_test.go +++ b/gexec/build_test.go @@ -250,7 +250,7 @@ var _ = Describe(".CompiledTestIn", func() { } }) - Context("a remote package", Label("remote"), func() { + Context("a remote package", Label("network"), func() { const remotePackage = "github.com/onsi/ginkgo/types" It("compiles the specified test package", func() { diff --git a/gmeasure/experiment.go b/gmeasure/experiment.go index 1c2d30096..a8341c5e6 100644 --- a/gmeasure/experiment.go +++ b/gmeasure/experiment.go @@ -463,6 +463,7 @@ func (e *Experiment) Sample(callback func(idx int), samplingConfig SamplingConfi minSamplingInterval := samplingConfig.MinSamplingInterval work := make(chan int) + defer close(work) if numParallel > 1 { for worker := 0; worker < numParallel; worker++ { go func() { diff --git a/gmeasure/experiment_test.go b/gmeasure/experiment_test.go index 9a8745c08..d0647272f 100644 --- a/gmeasure/experiment_test.go +++ b/gmeasure/experiment_test.go @@ -9,6 +9,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "github.com/onsi/gomega/gleak" "github.com/onsi/gomega/gmeasure" ) @@ -224,6 +225,7 @@ var _ = Describe("Experiment", func() { }) It("can run samples in parallel", func() { + g := gleak.Goroutines() lock := &sync.Mutex{} e.Sample(func(idx int) { @@ -237,6 +239,8 @@ var _ = Describe("Experiment", func() { defer lock.Unlock() Ω(len(indices)).Should(BeNumerically("~", 30, 10)) Ω(indices).Should(ConsistOf(ints(len(indices)))) + + Eventually(gleak.Goroutines).ShouldNot(gleak.HaveLeaked(g)) }) It("panics if the SamplingConfig does not specify a ceiling", func() { diff --git a/go.mod b/go.mod index 61bab1e4c..0146b2845 100644 --- a/go.mod +++ b/go.mod @@ -15,3 +15,5 @@ require ( golang.org/x/text v0.3.7 // indirect google.golang.org/protobuf v1.28.0 // indirect ) + +replace github.com/onsi/ginkgo/v2 => ../ginkgo \ No newline at end of file