Skip to content

Commit 41c1eed

Browse files
committed
test scenarios updated as per azure
Signed-off-by: gifi-siby <[email protected]>
1 parent 22b8f6a commit 41c1eed

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

internal/storage/gcp_native_object_storage.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,13 @@ func (gcs *GcpNativeObjectStorage) WalkWithObjects(ctx context.Context,
170170
return checkObjectStorageError(prefix, err)
171171
}
172172
if objAttrs.Prefix != "" {
173-
continue
174-
}
175-
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Name, ModifyTime: objAttrs.Updated}) {
176-
return nil
173+
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Prefix, ModifyTime: objAttrs.Updated}) {
174+
return nil
175+
}
176+
} else if objAttrs.Name != "" {
177+
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Name, ModifyTime: objAttrs.Updated}) {
178+
return nil
179+
}
177180
}
178181
}
179182
return nil

internal/storage/gcp_native_object_storage_test.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,11 @@ func TestGcpNativeObjectStorage(t *testing.T) {
147147
value []byte
148148
}{
149149
{false, "abc/", []byte("123")},
150-
{true, "abc/d/", []byte("1234")},
151-
{false, "abc/d/e", []byte("12345")},
150+
{true, "abc/d", []byte("1234")},
152151
{true, "abc/e/d", []byte("12354")},
153152
{true, "key_/1/1", []byte("111")},
154-
{true, "key_/1/2/", []byte("222")},
155-
{false, "key_/1/2/3", []byte("333")},
153+
{true, "key_/1/2", []byte("222")},
156154
{true, "key_/2/3", []byte("333")},
157-
{true, "key_/test.txt", []byte("333")},
158155
}
159156

160157
for _, test := range prepareTests {
@@ -172,10 +169,10 @@ func TestGcpNativeObjectStorage(t *testing.T) {
172169
prefix string
173170
expectedValue []string
174171
}{
175-
{true, "abc/", []string{"abc/e/d"}},
176-
{true, "key_/", []string{"key_/1/1", "key_/2/3", "key_/test.txt"}},
177-
{false, "abc/", []string{}},
178-
{false, "key_/", []string{"key_/test.txt"}},
172+
{true, "abc/", []string{"abc/d", "abc/e/d"}},
173+
{true, "key_/", []string{"key_/1/1", "key_/1/2", "key_/2/3"}},
174+
{false, "abc/", []string{"abc/d", "abc/e/"}},
175+
{false, "key_/", []string{"key_/1/", "key_/2/"}},
179176
}
180177

181178
for _, test := range insertWithPrefixTests {

0 commit comments

Comments
 (0)