Skip to content

Commit 74f82da

Browse files
committed
fix: fixed tests
Signed-off-by: Martin Chodur <m.chodur@seznam.cz>
1 parent b6e2265 commit 74f82da

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pkg/objstore/swift/swift.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ import (
2828
)
2929

3030
// DirDelim is the delimiter used to model a directory structure in an object store bucket.
31-
const DirDelim = '/'
31+
const (
32+
DirDelim = '/'
33+
SegmentsDir = "segments/"
34+
)
3235

3336
var DefaultConfig = Config{
3437
AuthVersion: 0, // Means autodetect of the auth API version by the library.
@@ -213,6 +216,9 @@ func (c *Container) Iter(_ context.Context, dir string, f func(string) error) er
213216
return objects, errors.Wrap(err, "swift list object names")
214217
}
215218
for _, object := range objects {
219+
if object == SegmentsDir {
220+
continue
221+
}
216222
if err := f(object); err != nil {
217223
return objects, errors.Wrap(err, "swift iteration over objects")
218224
}
@@ -263,14 +269,13 @@ func (c *Container) Attributes(_ context.Context, name string) (objstore.ObjectA
263269

264270
// Exists checks if the given object exists.
265271
func (c *Container) Exists(_ context.Context, name string) (bool, error) {
272+
found := true
266273
_, _, err := c.connection.Object(c.name, name)
267274
if c.IsObjNotFoundErr(err) {
268275
err = nil
276+
found = false
269277
}
270-
if err != nil {
271-
return false, errors.Wrap(err, "swift check if file exists")
272-
}
273-
return true, nil
278+
return found, err
274279
}
275280

276281
// IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations.

0 commit comments

Comments
 (0)