Skip to content

Commit

Permalink
Do not panic on errors in waitForCondition
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <github@ysh.us>
  • Loading branch information
yurishkuro committed Nov 3, 2024
1 parent 02bee05 commit 63707ab
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions plugin/storage/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ func (s *StorageIntegration) testGetServices(t *testing.T) {
found := s.waitForCondition(t, func(t *testing.T) bool {
var err error
actual, err = s.SpanReader.GetServices(context.Background())
require.NoError(t, err)
if err != nil {
t.Log(err)
return false
}
sort.Strings(actual)
t.Logf("Retrieved services: %v", actual)
if len(actual) > len(expected) {
Expand Down Expand Up @@ -246,7 +249,10 @@ func (s *StorageIntegration) testGetOperations(t *testing.T) {
var err error
actual, err = s.SpanReader.GetOperations(context.Background(),
spanstore.OperationQueryParameters{ServiceName: "example-service-1"})
require.NoError(t, err)
if err != nil {
t.Log(err)
return false
}
sort.Slice(actual, func(i, j int) bool {
return actual[i].Name < actual[j].Name
})
Expand Down Expand Up @@ -327,7 +333,10 @@ func (s *StorageIntegration) findTracesByQuery(t *testing.T, query *spanstore.Tr
found := s.waitForCondition(t, func(t *testing.T) bool {
var err error
traces, err = s.SpanReader.FindTraces(context.Background(), query)
require.NoError(t, err)
if err != nil {
t.Log(err)
return false
}
if len(expected) != len(traces) {
t.Logf("Expecting certain number of traces: expected: %d, actual: %d", len(expected), len(traces))
return false
Expand Down Expand Up @@ -464,7 +473,10 @@ func (s *StorageIntegration) testGetDependencies(t *testing.T) {
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)
if err != nil {
t.Log(err)
return false
}
sort.Slice(actual, func(i, j int) bool {
return actual[i].Parent < actual[j].Parent
})
Expand Down Expand Up @@ -495,7 +507,10 @@ func (s *StorageIntegration) testGetThroughput(t *testing.T) {
_ = s.waitForCondition(t, func(t *testing.T) bool {
var err error
actual, err = s.SamplingStore.GetThroughput(start, start.Add(time.Second*time.Duration(10)))
require.NoError(t, err)
if err != nil {
t.Log(err)
return false
}
return assert.ObjectsAreEqualValues(expected, len(actual))
})
assert.Len(t, actual, expected)
Expand All @@ -517,7 +532,10 @@ func (s *StorageIntegration) testGetLatestProbability(t *testing.T) {
found := s.waitForCondition(t, func(t *testing.T) bool {
var err error
actual, err = s.SamplingStore.GetLatestProbabilities()
require.NoError(t, err)
if err != nil {
t.Log(err)
return false
}
return assert.ObjectsAreEqualValues(expected, actual)
})
if !assert.True(t, found) {
Expand Down

0 comments on commit 63707ab

Please sign in to comment.