Skip to content

Commit

Permalink
Upgrade storage integration tests: DependencyReader to v2 (jaegertr…
Browse files Browse the repository at this point in the history
…acing#6477)

## Which problem is this PR solving?
- Subtask of jaegertracing#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 <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Signed-off-by: adityachopra29 <[email protected]>
  • Loading branch information
2 people authored and adityachopra29 committed Jan 9, 2025
1 parent 87dbb1c commit 00267fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
5 changes: 3 additions & 2 deletions plugin/storage/integration/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ")
}
}
Expand Down
6 changes: 4 additions & 2 deletions plugin/storage/integration/elasticsearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 12 additions & 4 deletions plugin/storage/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 00267fa

Please sign in to comment.