From 10af18598cce4edc7c2fac70285ac913e0cccb89 Mon Sep 17 00:00:00 2001 From: Zhengke Zhou Date: Tue, 7 Jan 2025 05:30:08 +0800 Subject: [PATCH] Upgrade storage integration tests: `DependencyReader` to v2 (#6477) ## Which problem is this PR solving? - Subtask of https://github.com/jaegertracing/jaeger/issues/6366 ## Description of the changes - use `/storage_v2/depstore.Reader` replaces `/storage/dependencystore.Reader` ## How was this change tested? - ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [ ] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: zzzk1 Signed-off-by: Yuri Shkuro Co-authored-by: Yuri Shkuro --- plugin/storage/integration/cassandra_test.go | 5 +++-- plugin/storage/integration/elasticsearch_test.go | 6 ++++-- plugin/storage/integration/integration.go | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/plugin/storage/integration/cassandra_test.go b/plugin/storage/integration/cassandra_test.go index a06ecdff681..59f26b46d00 100644 --- a/plugin/storage/integration/cassandra_test.go +++ b/plugin/storage/integration/cassandra_test.go @@ -93,11 +93,12 @@ func (s *CassandraStorageIntegration) initializeDependencyReaderAndWriter(t *tes err error ok bool ) - s.DependencyReader, err = f.CreateDependencyReader() + dependencyReader, err := f.CreateDependencyReader() require.NoError(t, err) + s.DependencyReader = v1adapter.NewDependencyReader(dependencyReader) // TODO: Update this when the factory interface has CreateDependencyWriter - if s.DependencyWriter, ok = s.DependencyReader.(dependencystore.Writer); !ok { + if s.DependencyWriter, ok = dependencyReader.(dependencystore.Writer); !ok { t.Log("DependencyWriter not implemented ") } } diff --git a/plugin/storage/integration/elasticsearch_test.go b/plugin/storage/integration/elasticsearch_test.go index 007380733d7..a708a6c512f 100644 --- a/plugin/storage/integration/elasticsearch_test.go +++ b/plugin/storage/integration/elasticsearch_test.go @@ -144,9 +144,11 @@ func (s *ESStorageIntegration) initSpanstore(t *testing.T, allTagsAsFields bool) s.ArchiveSpanWriter, err = f.CreateArchiveSpanWriter() require.NoError(t, err) - s.DependencyReader, err = f.CreateDependencyReader() + dependencyReader, err := f.CreateDependencyReader() require.NoError(t, err) - s.DependencyWriter = s.DependencyReader.(dependencystore.Writer) + s.DependencyReader = v1adapter.NewDependencyReader(dependencyReader) + + s.DependencyWriter = dependencyReader.(dependencystore.Writer) s.SamplingStore, err = f.CreateSamplingStore(1) require.NoError(t, err) diff --git a/plugin/storage/integration/integration.go b/plugin/storage/integration/integration.go index 3e3a377c630..f3132c41e21 100644 --- a/plugin/storage/integration/integration.go +++ b/plugin/storage/integration/integration.go @@ -27,6 +27,7 @@ import ( "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/samplingstore" "github.com/jaegertracing/jaeger/storage/spanstore" + "github.com/jaegertracing/jaeger/storage_v2/depstore" "github.com/jaegertracing/jaeger/storage_v2/tracestore" "github.com/jaegertracing/jaeger/storage_v2/v1adapter" ) @@ -48,7 +49,7 @@ type StorageIntegration struct { ArchiveSpanReader spanstore.Reader ArchiveSpanWriter spanstore.Writer DependencyWriter dependencystore.Writer - DependencyReader dependencystore.Reader + DependencyReader depstore.Reader SamplingStore samplingstore.Store Fixtures []*QueryFixtures @@ -499,13 +500,20 @@ func (s *StorageIntegration) testGetDependencies(t *testing.T) { Source: source, }, } - - require.NoError(t, s.DependencyWriter.WriteDependencies(time.Now(), expected)) + startTime := time.Now() + require.NoError(t, s.DependencyWriter.WriteDependencies(startTime, expected)) 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) + + actual, err = s.DependencyReader.GetDependencies( + context.Background(), + depstore.QueryParameters{ + StartTime: startTime, + EndTime: startTime.Add(time.Minute * 5), + }, + ) if err != nil { t.Log(err) return false