Skip to content

Commit

Permalink
test: added checks to debug the unit test failures in delayed spans (#…
Browse files Browse the repository at this point in the history
…989)

test: added checks to debug random unit test failures in delayed spans
  • Loading branch information
Angith authored Dec 20, 2024
1 parent 6707702 commit 3c02322
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions delayed_spans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"net/http"
"net/http/httptest"
"os"
"sync"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -50,6 +51,12 @@ func TestPartiallyFlushDelayedSpans(t *testing.T) {

generateSomeTraffic(s, maxDelayedSpans)

// serverless agent should not be present for this test to pass.
// following check is added for debugging random failures in the unit tests of delayed spans
// TODO: remove it once the issue is resolved.
url, _ := os.LookupEnv("INSTANA_ENDPOINT_URL")
assert.Equal(t, "", url)

assert.Len(t, delayed.spans, maxDelayedSpans)

notReadyAfter := maxDelayedSpans / 10
Expand All @@ -76,6 +83,12 @@ func TestFlushDelayedSpans(t *testing.T) {

generateSomeTraffic(s, maxDelayedSpans)

// serverless agent should not be present for this test to pass.
// following check is added for debugging random failures in the unit tests of delayed spans
// TODO: remove it once the issue is resolved.
_, isURLPresent := os.LookupEnv("INSTANA_ENDPOINT_URL")
assert.Equal(t, false, isURLPresent)

assert.Len(t, delayed.spans, maxDelayedSpans)

sensor.agent = alwaysReadyClient{}
Expand All @@ -101,6 +114,12 @@ func TestParallelFlushDelayedSpans(t *testing.T) {

generateSomeTraffic(s, maxDelayedSpans*2)

// serverless agent should not be present for this test to pass.
// following check is added for debugging random failures in the unit tests of delayed spans
// TODO: remove it once the issue is resolved.
_, isURLPresent := os.LookupEnv("INSTANA_ENDPOINT_URL")
assert.Equal(t, false, isURLPresent)

assert.Len(t, delayed.spans, maxDelayedSpans)

workers := 15
Expand Down

0 comments on commit 3c02322

Please sign in to comment.