From 22c07436ef3e12836c8121fa173b5103ca926f7a Mon Sep 17 00:00:00 2001 From: Aaron Son Date: Tue, 8 Jul 2025 11:02:42 -0700 Subject: [PATCH] integration-tests/go-sql-server-driver: Attempt to SIGQUIT a hung call dolt_gc in CI. --- .../go-sql-server-driver/auto_gc_test.go | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/integration-tests/go-sql-server-driver/auto_gc_test.go b/integration-tests/go-sql-server-driver/auto_gc_test.go index 8938c527e6..7afc62850f 100644 --- a/integration-tests/go-sql-server-driver/auto_gc_test.go +++ b/integration-tests/go-sql-server-driver/auto_gc_test.go @@ -23,7 +23,10 @@ import ( "path/filepath" "strconv" "strings" + "sync" + "syscall" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -45,6 +48,7 @@ func TestAutoGC(t *testing.T) { name string }{{true, "Archive"}, {false, "NoArchive"}} { t.Run(sa.name, func(t *testing.T) { + t.Parallel() t.Run("CommitEvery16", func(t *testing.T) { t.Parallel() var s AutoGCTest @@ -80,9 +84,8 @@ func TestAutoGC(t *testing.T) { s.EnableRemotesAPI = true s.Archive = sa.archive enabled_16, final_16 = runAutoGCTest(t, &s, numStatements, 2) - // XXX: Reenable these after tuning to be more reliable. - // assert.Contains(t, string(s.PrimaryServer.Output.Bytes()), "Successfully completed auto GC") - // assert.Contains(t, string(s.StandbyServer.Output.Bytes()), "Successfully completed auto GC") + assert.Contains(t, string(s.PrimaryServer.Output.Bytes()), "Successfully completed auto GC") + assert.Contains(t, string(s.StandbyServer.Output.Bytes()), "Successfully completed auto GC") assert.NotContains(t, string(s.PrimaryServer.Output.Bytes()), "dangling references requested during GC") assert.NotContains(t, string(s.StandbyServer.Output.Bytes()), "dangling references requested during GC") }) @@ -389,7 +392,24 @@ func runAutoGCTest(t *testing.T, s *AutoGCTest, numStatements int, commitEvery i require.NoError(t, err) conn, err := s.PrimaryDB.Conn(ctx) require.NoError(t, err) - _, err = conn.ExecContext(ctx, "call dolt_gc('--full')") + + done := make(chan struct{}) + var wg sync.WaitGroup + wg.Add(2) + go func() { + defer close(done) + defer wg.Done() + _, err = conn.ExecContext(ctx, "call dolt_gc('--full')") + }() + go func() { + defer wg.Done() + select { + case <-done: + case <-time.After(1*time.Minute): + s.PrimaryServer.Cmd.Process.Signal(syscall.SIGQUIT) + } + }() + wg.Wait() require.NoError(t, err) require.NoError(t, conn.Close()) after, err := GetRepoSize(s.PrimaryDir)