Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <github@ysh.us>
  • Loading branch information
yurishkuro committed Apr 5, 2024
1 parent 5766a13 commit ad54441
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
16 changes: 6 additions & 10 deletions plugin/storage/integration/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,16 @@ func (s *ESStorageIntegration) initializeESFactory(t *testing.T, allTagsAsFields
require.NoError(t, command.ParseFlags(args))
f.InitFromViper(v, s.logger)
require.NoError(t, f.Initialize(metrics.NullFactory, s.logger))
t.Cleanup(func() {
require.NoError(t, f.Close())
})

// TODO ideally we need to close the factory once the test is finished
// but because esCleanup calls initialize() we get a panic later
// t.Cleanup(func() {
// require.NoError(t, f.Close())
// })
return f
}

func (s *ESStorageIntegration) initSpanstore(t *testing.T, allTagsAsFields bool) {
// client := s.getEsClient(t)
// opts := es.NewOptions(primaryNamespace, archiveNamespace)
// cfg := opts.Primary.Configuration
// cfg.IndexPrefix = indexPrefix
// cfg.Tags.AllAsFields = allTagsAsFields
// f, err := es.NewFactoryWithConfigTest(cfg, metrics.NullFactory, s.logger, client)
// require.NoError(t, err)
f := s.initializeESFactory(t, allTagsAsFields)
var err error
s.SpanWriter, err = f.CreateSpanWriter()
Expand Down
20 changes: 15 additions & 5 deletions plugin/storage/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,22 @@ func (s *StorageIntegration) testGetDependencies(t *testing.T) {

require.NoError(t, s.DependencyWriter.WriteDependencies(time.Now(), expected))
s.refresh(t)
actual, err := s.DependencyReader.GetDependencies(context.Background(), time.Now(), 5*time.Minute)
require.NoError(t, err)
sort.Slice(actual, func(i, j int) bool {
return actual[i].Parent < actual[j].Parent

var actual []model.DependencyLink
found := s.waitForCondition(t, func(t *testing.T) bool {
var err error
actual, err = s.DependencyReader.GetDependencies(context.Background(), time.Now(), 5*time.Minute)
require.NoError(t, err)
sort.Slice(actual, func(i, j int) bool {
return actual[i].Parent < actual[j].Parent
})
return assert.ObjectsAreEqualValues(expected, actual)
})
assert.EqualValues(t, expected, actual)

if !assert.True(t, found) {
t.Log("\t Expected:", expected)
t.Log("\t Actual :", actual)
}
}

// === Sampling Store Integration Tests ===
Expand Down

0 comments on commit ad54441

Please sign in to comment.