From 806da162bb1addda0afa4d7fc36dea1ca107ae02 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 18:36:50 -0800 Subject: [PATCH] test: preserve manifest preparation through the production provider --- .../durable/provider_manifest_test.go | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 seaweed-block/core/frontend/durable/provider_manifest_test.go diff --git a/seaweed-block/core/frontend/durable/provider_manifest_test.go b/seaweed-block/core/frontend/durable/provider_manifest_test.go new file mode 100644 index 0000000000..c68b88191d --- /dev/null +++ b/seaweed-block/core/frontend/durable/provider_manifest_test.go @@ -0,0 +1,33 @@ +package durable_test + +import ( + "context" + "sync/atomic" + "testing" + + "github.com/seaweedfs/seaweed-block/core/storage" +) + +type manifestAwareRemote struct { + *storage.MemChunkRemote + prepared atomic.Int32 +} + +func (r *manifestAwareRemote) PrepareManifest(ctx context.Context, base, next storage.ChunkHead, chunkBytes uint64) (storage.ChunkHead, []string, error) { + r.prepared.Add(1) + return next, nil, ctx.Err() +} +func TestWALStoreChunk_ProviderPreservesManifestCapability(t *testing.T) { + r := &manifestAwareRemote{MemChunkRemote: storage.NewMemChunkRemote()} + p := chunkProvider(t, t.TempDir(), r, v1View(), 0) + s := openRecovered(t, p) + if _, err := s.Write(0, block(0x65)); err != nil { + t.Fatal(err) + } + if _, err := p.CaptureVolume(context.Background(), "v1"); err != nil { + t.Fatal(err) + } + if r.prepared.Load() != 1 { + t.Fatalf("provider erased remote manifest capability: preparations=%d", r.prepared.Load()) + } +}