From befb3643ee5514eded10f0cdbe5cd3cc4d62b4f4 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Tue, 9 Jun 2020 12:40:02 +0200 Subject: [PATCH] Remove template creation from factory, fix e2e tests Signed-off-by: Pavol Loffay --- plugin/storage/es/factory.go | 8 -------- .../storage/integration/elasticsearch_test.go | 19 +++++++++---------- scripts/travis/es-integration-test.sh | 1 - 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/plugin/storage/es/factory.go b/plugin/storage/es/factory.go index 8d77bbe9a69..232697a41e9 100644 --- a/plugin/storage/es/factory.go +++ b/plugin/storage/es/factory.go @@ -114,14 +114,6 @@ func (f *Factory) CreateSpanWriter() (spanstore.Writer, error) { // CreateDependencyReader implements storage.Factory func (f *Factory) CreateDependencyReader() (dependencystore.Reader, error) { reader := esDepStore.NewDependencyStore(f.primaryClient, f.logger, f.primaryConfig.GetIndexPrefix()) - - if f.primaryConfig.IsCreateIndexTemplates() { - dependenciesMappings := GetDependenciesMappings(f.primaryConfig.GetNumShards(), f.primaryConfig.GetNumReplicas(), f.primaryConfig.GetVersion()) - err := reader.CreateTemplates(dependenciesMappings) - if err != nil { - return nil, err - } - } return reader, nil } diff --git a/plugin/storage/integration/elasticsearch_test.go b/plugin/storage/integration/elasticsearch_test.go index 3c8f8bdbf22..d899577f4b8 100644 --- a/plugin/storage/integration/elasticsearch_test.go +++ b/plugin/storage/integration/elasticsearch_test.go @@ -78,16 +78,6 @@ func (s *ESStorageIntegration) initializeES(allTagsAsFields, archive bool) error s.logger, _ = testutils.NewLogger() s.client = rawClient - - esVersion, err := s.getVersion() - if err != nil { - return err - } - s.bulkProcessor, _ = s.client.BulkProcessor().Do(context.Background()) - client := eswrapper.WrapESClient(s.client, s.bulkProcessor, esVersion) - dependencyStore := dependencystore.NewDependencyStore(client, s.logger, indexPrefix) - s.DependencyReader = dependencyStore - s.DependencyWriter = dependencyStore s.initSpanstore(allTagsAsFields, archive) s.CleanUp = func() error { return s.esCleanUp(allTagsAsFields, archive) @@ -109,6 +99,7 @@ func (s *ESStorageIntegration) esCleanUp(allTagsAsFields, archive bool) error { func (s *ESStorageIntegration) initSpanstore(allTagsAsFields, archive bool) error { bp, _ := s.client.BulkProcessor().BulkActions(1).FlushInterval(time.Nanosecond).Do(context.Background()) + s.bulkProcessor = bp esVersion, err := s.getVersion() if err != nil { return err @@ -139,6 +130,14 @@ func (s *ESStorageIntegration) initSpanstore(allTagsAsFields, archive bool) erro TagDotReplacement: tagKeyDeDotChar, Archive: archive, }) + dependencyStore := dependencystore.NewDependencyStore(client, s.logger, indexPrefix) + depMapping := es.GetDependenciesMappings(5, 1, client.GetVersion()) + err = dependencyStore.CreateTemplates(depMapping) + if err != nil { + return err + } + s.DependencyReader = dependencyStore + s.DependencyWriter = dependencyStore return nil } diff --git a/scripts/travis/es-integration-test.sh b/scripts/travis/es-integration-test.sh index 74ee57859db..63a8d5ee841 100755 --- a/scripts/travis/es-integration-test.sh +++ b/scripts/travis/es-integration-test.sh @@ -28,4 +28,3 @@ SPAN_STORAGE_TYPE=elasticsearch ./cmd/query/query-linux-$GOARCH --es.server-urls PID=$(echo $!) make token-propagation-integration-test kill -9 ${PID} -docker kill $CID