You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ha...@apache.org on 2026/05/14 06:12:18 UTC

(skywalking-banyandb) 08/50: test(integration): restore SharedContext in vectorized parity AfterAll

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch vectorized-query
in repository https://gitbox.apache.org/repos/asf/skywalking-banyandb.git

commit 0e0638741f597941c4885f58a880b2cd8d9589ca
Author: Hongtao Gao <ha...@gmail.com>
AuthorDate: Wed May 6 14:49:15 2026 +0000

    test(integration): restore SharedContext in vectorized parity AfterAll
    
    The "vectorized parity" Describe in test/integration/standalone/query
    mutates the package-global casesmeasure.SharedContext and
    casestopn.SharedContext to point at a fresh vectorized-flagged
    standalone cluster, then closes that cluster in AfterAll. Ginkgo runs
    sibling top-level "TopN Tests" / "Scanning Measures" tables between
    this AfterAll and the next Describe's BeforeAll, so leaving SharedContext
    pointing at the closed-down conn caused those siblings to time out at
    the 10s gm.Eventually(...).WithTimeout(10*time.Second), producing a
    ~33% flake rate under -race.
    
    Save the prior SharedContexts in BeforeAll and restore them in AfterAll
    before tearing the cluster down. The original cluster #1 from
    SynchronizedBeforeSuite is still alive at that point, so siblings
    revert to a working connection.
    
    Verified clean: 3/3 fresh runs at 488/488 specs (vs ~1/3 failure
    pre-fix).
---
 test/integration/standalone/query/vectorized_test.go | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/test/integration/standalone/query/vectorized_test.go b/test/integration/standalone/query/vectorized_test.go
index 15f530e67..0124ae919 100644
--- a/test/integration/standalone/query/vectorized_test.go
+++ b/test/integration/standalone/query/vectorized_test.go
@@ -52,8 +52,17 @@ var _ = ginkgo.Describe("vectorized parity", ginkgo.Ordered, func() {
 	var (
 		vectorizedConn *grpc.ClientConn
 		stopFn         func()
+		// Save the package-global SharedContexts so AfterAll can restore
+		// them. Sibling Describes may run *between* this AfterAll and the
+		// next BeforeAll (e.g. the top-level "TopN Tests" / "Scanning
+		// Measures" tables); leaving SharedContext pointing at our
+		// closed-down cluster makes those siblings time out.
+		savedMeasureCtx helpers.SharedContext
+		savedTopNCtx    helpers.SharedContext
 	)
 	ginkgo.BeforeAll(func() {
+		savedMeasureCtx = casesmeasure.SharedContext
+		savedTopNCtx = casestopn.SharedContext
 		path, diskCleanupFn, pathErr := test.NewSpace()
 		gomega.Expect(pathErr).NotTo(gomega.HaveOccurred())
 		ports, portsErr := test.AllocateFreePorts(5)
@@ -85,6 +94,12 @@ var _ = ginkgo.Describe("vectorized parity", ginkgo.Ordered, func() {
 		casestopn.SharedContext = sharedCtx
 	})
 	ginkgo.AfterAll(func() {
+		// Restore the saved SharedContexts BEFORE tearing the cluster down
+		// so any sibling Describe that runs between this AfterAll and its
+		// own BeforeAll observes a live connection (the original cluster
+		// #1 from SynchronizedBeforeSuite is still up at this point).
+		casesmeasure.SharedContext = savedMeasureCtx
+		casestopn.SharedContext = savedTopNCtx
 		if vectorizedConn != nil {
 			gomega.Expect(vectorizedConn.Close()).To(gomega.Succeed())
 		}