From dfee72ea311cbb3b09e10dee83de1ebad6647869 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 1 Dec 2026 17:12:57 -0800 Subject: [PATCH] filer/store_test: roll back a transaction an assertion abandons A failed assertion between BeginTransaction and the commit left the transaction open with its locks, and the cleanup's DROP SCHEMA then waited on them until the go test timeout. Co-Authored-By: Claude Opus 5.5 --- weed/filer/store_test/conformance.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/weed/filer/store_test/conformance.go b/weed/filer/store_test/conformance.go index 753ad80be3..62a60a7e2b 100644 --- a/weed/filer/store_test/conformance.go +++ b/weed/filer/store_test/conformance.go @@ -137,18 +137,22 @@ func TestFilerStoreConformance(t *testing.T, store filer.FilerStore) { }) t.Run("transaction", func(t *testing.T) { - txCtx, err := store.BeginTransaction(ctx) - require.NoError(t, err) + begin := func() context.Context { + txCtx, err := store.BeginTransaction(ctx) + require.NoError(t, err) + t.Cleanup(func() { store.RollbackTransaction(txCtx) }) + return txCtx + } + txCtx := begin() require.NoError(t, store.InsertEntry(txCtx, file("/buckets/bkt1/rolledback", 1))) require.NoError(t, store.RollbackTransaction(txCtx)) notFound(t, "/buckets/bkt1/rolledback") - txCtx, err = store.BeginTransaction(ctx) - require.NoError(t, err) + txCtx = begin() require.NoError(t, store.InsertEntry(txCtx, file("/buckets/bkt1/committed", 1))) require.NoError(t, store.KvPut(txCtx, []byte("tx-key"), []byte("tx-value"))) require.NoError(t, store.CommitTransaction(txCtx)) - _, err = store.FindEntry(ctx, "/buckets/bkt1/committed") + _, err := store.FindEntry(ctx, "/buckets/bkt1/committed") require.NoError(t, err) v, err := store.KvGet(ctx, []byte("tx-key")) require.NoError(t, err)