Skip to content

Commit

Permalink
Flaky blobs caps systemtest
Browse files Browse the repository at this point in the history
AB#5311
  • Loading branch information
eccles committed Aug 14, 2024
1 parent 5892023 commit af177d9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
33 changes: 24 additions & 9 deletions azblob/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,28 @@ import (

// Count counts the number of blobs filtered by the given tags filter
func (azp *Storer) Count(ctx context.Context, tagsFilter string, opts ...Option) (int64, error) {

logger.Sugar.Debugf("Count")

r, err := azp.FilteredList(ctx, tagsFilter, opts...)
if err != nil {
return 0, err
}

return int64(len(r.Items)), nil
log := logger.Sugar.FromContext(ctx)
defer log.close()

log.Debugf("Count")

var count int64
var m string
opts = append(opts, WithListMarker(&m))

for {
r, err := azp.FilteredList(ctx, tagsFilter, opts...)
if err != nil {
return 0, err
}
count += int64(len(r.Items))
log.Debugf("Count %d (%v)", count, r.Marker)
if r.Marker == nil {
break
}
}
log.Debugf("Count %d", count)
return count, nil
}

type FilterResponse struct {
Expand Down Expand Up @@ -57,6 +70,8 @@ type FilterResponse struct {
//
// Returns all blobs with the specific tag filter.
func (azp *Storer) FilteredList(ctx context.Context, tagsFilter string, opts ...Option) (*FilterResponse, error) {
log := logger.Sugar.FromContext(ctx)
defer log.close()
span, ctx := tracing.StartSpanFromContext(ctx, "FilteredList")
defer span.Finish()

Expand Down
11 changes: 11 additions & 0 deletions azblob/logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package azbus

import (
"github.com/datatrails/go-datatrails-common/logger"
)

const (
DebugLevel = logger.DebugLevel
)

type Logger = logger.Logger
2 changes: 2 additions & 0 deletions azblob/storer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type Storer struct {
containerURL string
containerClient *ContainerClient
serviceClient *ServiceClient

log Logger
}

// New returns new az blob read/write object
Expand Down

0 comments on commit af177d9

Please sign in to comment.