Skip to content

Commit

Permalink
Moved release to Thursday; Cleanup tests. (#1763)
Browse files Browse the repository at this point in the history
* Moved release to Thursday.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>

* Simplified tests.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka authored and squat committed Nov 20, 2019
1 parent c1d7c2f commit a1c88ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 35 deletions.
3 changes: 2 additions & 1 deletion docs/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ Release shepherd responsibilities:

| Release | Time of first RC | Shepherd (Github handle) |
|-----------|--------------------------|--------------------------|
| v0.9.0 | (planned) 20.11.2019 | TBC |
| v0.10.0 | (planned) 8.01.2019 | TBD |
| v0.9.0 | (planned) 21.11.2019 | `@bwplotka` |
| v0.8.0 | (planned) 9.10.2019 | `@bwplotka` |
| v0.7.0 | (planned) 28.08.2019 | `@domgreen` |
| v0.6.0 | (planned) 12.07.2019 | `@GiedriusS` |
Expand Down
40 changes: 6 additions & 34 deletions pkg/store/bucket_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import (
"io/ioutil"
"os"
"path/filepath"
"sync"
"testing"
"time"

"github.com/go-kit/kit/log"
"github.com/oklog/ulid"
"github.com/pkg/errors"
"github.com/prometheus/prometheus/pkg/relabel"
"github.com/prometheus/prometheus/pkg/timestamp"
"github.com/prometheus/prometheus/tsdb/labels"
Expand All @@ -21,7 +19,6 @@ import (
"github.com/thanos-io/thanos/pkg/objstore"
"github.com/thanos-io/thanos/pkg/objstore/inmem"
"github.com/thanos-io/thanos/pkg/objstore/objtesting"
"github.com/thanos-io/thanos/pkg/runutil"
storecache "github.com/thanos-io/thanos/pkg/store/cache"
"github.com/thanos-io/thanos/pkg/store/storepb"
"github.com/thanos-io/thanos/pkg/testutil"
Expand Down Expand Up @@ -70,21 +67,13 @@ func (c *swappableCache) Series(b ulid.ULID, id uint64) ([]byte, bool) {
}

type storeSuite struct {
cancel context.CancelFunc
wg sync.WaitGroup

store *BucketStore
minTime, maxTime int64
cache *swappableCache

logger log.Logger
}

func (s *storeSuite) Close() {
s.cancel()
s.wg.Wait()
}

func prepareTestBlocks(t testing.TB, now time.Time, count int, dir string, bkt objstore.Bucket,
series []labels.Labels, extLset labels.Labels) (blocks int, minTime, maxTime int64) {
ctx := context.Background()
Expand Down Expand Up @@ -142,9 +131,7 @@ func prepareStoreWithTestBlocks(t testing.TB, dir string, bkt objstore.Bucket, m
blocks, minTime, maxTime := prepareTestBlocks(t, time.Now(), 3, dir, bkt,
series, extLset)

ctx, cancel := context.WithCancel(context.Background())
s := &storeSuite{
cancel: cancel,
logger: log.NewLogfmtLogger(os.Stderr),
cache: &swappableCache{},
minTime: minTime,
Expand All @@ -159,27 +146,14 @@ func prepareStoreWithTestBlocks(t testing.TB, dir string, bkt objstore.Bucket, m
s.store.partitioner = naivePartitioner{}
}

s.wg.Add(1)
go func() {
defer s.wg.Done()

if err := runutil.Repeat(100*time.Millisecond, ctx.Done(), func() error {
return store.SyncBlocks(ctx)
}); err != nil && ctx.Err() == nil {
t.Fatal(err)
}
}()
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

rctx, rcancel := context.WithTimeout(ctx, 30*time.Second)
defer rcancel()

testutil.Ok(t, runutil.Retry(100*time.Millisecond, rctx.Done(), func() error {
if store.numBlocks() < blocks {
return errors.New("not all blocks loaded")
}
return nil
}))
testutil.Ok(t, store.SyncBlocks(ctx))

if store.numBlocks() < blocks {
t.Fatalf("not all blocks loaded got %v, expected %v", store.numBlocks(), blocks)
}
return s
}

Expand Down Expand Up @@ -393,7 +367,6 @@ func TestBucketStore_e2e(t *testing.T) {
defer func() { testutil.Ok(t, os.RemoveAll(dir)) }()

s := prepareStoreWithTestBlocks(t, dir, bkt, false, 0, emptyRelabelConfig)
defer s.Close()

t.Log("Test with no index cache")
s.cache.SwapWith(noopCache{})
Expand Down Expand Up @@ -442,7 +415,6 @@ func TestBucketStore_ManyParts_e2e(t *testing.T) {
defer func() { testutil.Ok(t, os.RemoveAll(dir)) }()

s := prepareStoreWithTestBlocks(t, dir, bkt, true, 0, emptyRelabelConfig)
defer s.Close()

indexCache, err := storecache.NewIndexCache(s.logger, nil, storecache.Opts{
MaxItemSizeBytes: 1e5,
Expand Down

0 comments on commit a1c88ba

Please sign in to comment.