Skip to content

Commit

Permalink
Remove template creation from factory, fix e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pavol Loffay <[email protected]>
  • Loading branch information
pavolloffay committed Jun 9, 2020
1 parent 9d8d003 commit befb364
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
8 changes: 0 additions & 8 deletions plugin/storage/es/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
19 changes: 9 additions & 10 deletions plugin/storage/integration/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
}

Expand Down
1 change: 0 additions & 1 deletion scripts/travis/es-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit befb364

Please sign in to comment.