mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
test: preserve manifest preparation through the production provider
This commit is contained in:
1 parent
4479bd4361
commit
806da162bb
1 file changed
+33
@@ -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())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user