mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-26 01:44:48 +00:00
filer: clean up manifest resolve error propagation and add webdav test (#78) Drop GitHub issue references from comments and trim verbose comments. Replace the viewFromChunksOrErr helper with the existing NonOverlappingVisibleIntervals + ViewFromVisibleIntervals at the stream call sites, and add a WebDavFile.Read regression test for the manifest resolution failure path. Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
27 lines
846 B
Go
27 lines
846 B
Go
package filer
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// Stream preparation must fail when chunk manifest resolution fails, instead of serving a zero-filled stream.
|
|
func TestPrepareStreamContent_ManifestResolveFailure(t *testing.T) {
|
|
master := &testMasterClient{}
|
|
|
|
chunks := []*filer_pb.FileChunk{
|
|
{FileId: "1,1879011dc64abd40", IsChunkManifest: true, Offset: 0, Size: 1 << 20},
|
|
}
|
|
|
|
_, err := PrepareStreamContentWithThrottler(context.Background(), master, noopJwt, chunks, 0, 1<<20, 0)
|
|
assert.Error(t, err)
|
|
assert.Contains(t, err.Error(), "fail to read manifest")
|
|
|
|
_, err = PrepareStreamContentWithPrefetch(context.Background(), master, noopJwt, chunks, 0, 1<<20, 0, 4)
|
|
assert.Error(t, err)
|
|
assert.Contains(t, err.Error(), "fail to read manifest")
|
|
}
|