Skip to content

Commit

Permalink
Remove race condition by disabling esIndexCleaner till after SmokeTes… (
Browse files Browse the repository at this point in the history
#437)

* Remove race condition by disabling esIndexCleaner till after SmokeTest runs

Signed-off-by: Kevin Earls <[email protected]>

* Simplify *bool references

Signed-off-by: Kevin Earls <[email protected]>
  • Loading branch information
kevinearls authored and objectiser committed May 28, 2019
1 parent 3469391 commit 18d5077
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/e2e/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strings"
"testing"

"k8s.io/apimachinery/pkg/types"
framework "github.com/operator-framework/operator-sdk/pkg/test"
"github.com/operator-framework/operator-sdk/pkg/test/e2eutil"
log "github.com/sirupsen/logrus"
Expand All @@ -26,6 +27,8 @@ type ElasticSearchTestSuite struct {
suite.Suite
}

var esEnabled = false

func(suite *ElasticSearchTestSuite) SetupSuite() {
t = suite.T()
var err error
Expand Down Expand Up @@ -103,9 +106,6 @@ func (suite *ElasticSearchTestSuite) TestSimpleProd() {
}

func (suite *ElasticSearchTestSuite) TestEsIndexCleaner() {
// Skip until https://github.com/jaegertracing/jaeger/issues/1468 is fixed
t.Skip()

name := "test-es-index-cleaner"
j := getJaegerAllInOne(name)

Expand All @@ -128,6 +128,14 @@ func (suite *ElasticSearchTestSuite) TestEsIndexCleaner() {
err = SmokeTest("http://localhost:16686/api/traces", "http://localhost:14268/api/traces", "foo-bar", retryInterval, timeout)
require.NoError(t, err, "Error running smoketest")

// Once we've created a span with the smoke test, enable the index cleaer
key := types.NamespacedName{Name:name, Namespace:namespace}
err = fw.Client.Get(context.Background(), key, j)
require.NoError(t, err)
esEnabled = true
err = fw.Client.Update(context.Background(), j)
require.NoError(t, err)

esPod, err := GetPod(storageNamespace, "elasticsearch", "elasticsearch", fw.KubeClient)
require.NoError(t, err, "Error getting Pod")

Expand Down Expand Up @@ -196,6 +204,7 @@ func getJaegerAllInOne(name string) *v1.Jaeger {
"es.server-urls": esServerUrls,
}),
EsIndexCleaner: v1.JaegerEsIndexCleanerSpec{
Enabled: &esEnabled,
Schedule: "*/1 * * * *",
NumberOfDays: &numberOfDays,
},
Expand Down

0 comments on commit 18d5077

Please sign in to comment.