fix(storage): fix Azure Blob dump failing with file does not exist (#38814) (#38828)

backport #38814
This commit is contained in:
wxiaoguang
2026-08-08 07:08:46 +08:00
committed by GitHub
parent cca0c65a6c
commit fe252be0ae
4 changed files with 44 additions and 27 deletions
+9 -1
View File
@@ -4,6 +4,7 @@
package storage
import (
"io"
"net/http"
"strings"
"testing"
@@ -31,6 +32,11 @@ func testStorageIterator(t *testing.T, typStr Type, cfg *setting.Storage) {
_, err = l.Save(f[0], strings.NewReader(f[1]), -1)
assert.NoError(t, err)
}
defer func() {
for _, f := range testFiles {
_ = l.Delete(f[0])
}
}()
expectedList := map[string][]string{
"a": {"a/1.txt"},
@@ -43,7 +49,9 @@ func testStorageIterator(t *testing.T, typStr Type, cfg *setting.Storage) {
for dir, expected := range expectedList {
count := 0
err = l.IterateObjects(dir, func(path string, f Object) error {
defer f.Close()
content, err := io.ReadAll(f)
assert.NoError(t, err)
assert.NotEmpty(t, content)
assert.Contains(t, expected, path)
count++
return nil