From c9d3c79c54564b50237bf5914b342d7fb129d56e Mon Sep 17 00:00:00 2001
From: Tom Wilkie <tom.wilkie@gmail.com>
Date: Wed, 8 May 2019 09:48:39 +0100
Subject: [PATCH] Remove unnecessarily long wait times in tests.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
---
 pkg/ingester/flush_test.go    |  6 ++----
 pkg/ingester/ingester_test.go | 11 +----------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/pkg/ingester/flush_test.go b/pkg/ingester/flush_test.go
index f5c14680..0b53c08e 100644
--- a/pkg/ingester/flush_test.go
+++ b/pkg/ingester/flush_test.go
@@ -2,7 +2,6 @@ package ingester
 
 import (
 	"fmt"
-	"os"
 	"sort"
 	"sync"
 	"testing"
@@ -10,9 +9,7 @@ import (
 
 	"github.com/cortexproject/cortex/pkg/chunk"
 	"github.com/cortexproject/cortex/pkg/ring"
-	"github.com/cortexproject/cortex/pkg/util"
 	"github.com/cortexproject/cortex/pkg/util/flagext"
-	"github.com/go-kit/kit/log"
 	"github.com/grafana/loki/pkg/chunkenc"
 	"github.com/grafana/loki/pkg/logproto"
 	"github.com/prometheus/common/model"
@@ -27,7 +24,7 @@ const (
 )
 
 func init() {
-	util.Logger = log.NewLogfmtLogger(os.Stdout)
+	//util.Logger = log.NewLogfmtLogger(os.Stdout)
 }
 
 func TestChunkFlushingIdle(t *testing.T) {
@@ -81,6 +78,7 @@ func defaultIngesterTestConfig() Config {
 	cfg.LifecyclerConfig.ListenPort = func(i int) *int { return &i }(0)
 	cfg.LifecyclerConfig.Addr = "localhost"
 	cfg.LifecyclerConfig.ID = "localhost"
+	cfg.LifecyclerConfig.FinalSleep = 0
 	return cfg
 }
 
diff --git a/pkg/ingester/ingester_test.go b/pkg/ingester/ingester_test.go
index 995366b7..16f395b5 100644
--- a/pkg/ingester/ingester_test.go
+++ b/pkg/ingester/ingester_test.go
@@ -13,19 +13,10 @@ import (
 	"google.golang.org/grpc"
 
 	"github.com/cortexproject/cortex/pkg/chunk"
-	"github.com/cortexproject/cortex/pkg/ring"
-	"github.com/cortexproject/cortex/pkg/util/flagext"
 )
 
 func TestIngester(t *testing.T) {
-	var ingesterConfig Config
-	flagext.DefaultValues(&ingesterConfig)
-	ingesterConfig.LifecyclerConfig.RingConfig.Mock = ring.NewInMemoryKVClient()
-	ingesterConfig.LifecyclerConfig.NumTokens = 1
-	ingesterConfig.LifecyclerConfig.ListenPort = func(i int) *int { return &i }(0)
-	ingesterConfig.LifecyclerConfig.Addr = "localhost"
-	ingesterConfig.LifecyclerConfig.ID = "localhost"
-
+	ingesterConfig := defaultIngesterTestConfig()
 	store := &mockStore{
 		chunks: map[string][]chunk.Chunk{},
 	}
-- 
GitLab