From fe856928c4f8db6be56474e6c8872aa36f089881 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 28 Jan 2026 17:02:53 -0800 Subject: [PATCH] s3tables: Add t field to TestCluster for logging Add *testing.T field to TestCluster struct and initialize it in startMiniCluster. This allows Stop() to properly log warnings when cluster shutdown times out. Includes the t field in the test cluster initialization and restores the logging statement in Stop(). --- test/s3tables/s3tables_integration_test.go | 3 ++- test/s3tables/setup.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/s3tables/s3tables_integration_test.go b/test/s3tables/s3tables_integration_test.go index 4e8adf4b5..475182853 100644 --- a/test/s3tables/s3tables_integration_test.go +++ b/test/s3tables/s3tables_integration_test.go @@ -416,6 +416,7 @@ func startMiniCluster(t *testing.T) (*TestCluster, error) { s3Endpoint := fmt.Sprintf("http://127.0.0.1:%d", s3Port) cluster := &TestCluster{ + t: t, dataDir: testDir, ctx: ctx, cancel: cancel, @@ -526,7 +527,7 @@ func (c *TestCluster) Stop() { case <-timer.C: // Timeout - goroutine doesn't respond to context cancel // This may indicate the mini cluster didn't shut down cleanly - // (Note: Warning is logged at test level when tests access cluster.Stop()) + c.t.Log("Warning: Test cluster shutdown timed out after 2 seconds") } // Reset the global cmdMini flags to prevent state leakage to other tests diff --git a/test/s3tables/setup.go b/test/s3tables/setup.go index 151adf3d7..2d0c9a3c0 100644 --- a/test/s3tables/setup.go +++ b/test/s3tables/setup.go @@ -4,11 +4,13 @@ import ( "context" "net/http" "sync" + "testing" "time" ) // TestCluster manages the weed mini instance for integration testing type TestCluster struct { + t *testing.T dataDir string ctx context.Context cancel context.CancelFunc