Skip to content

Commit

Permalink
adds trace-id url
Browse files Browse the repository at this point in the history
Signed-off-by: Afzal Ansari <[email protected]>
  • Loading branch information
afzal442 committed Jul 17, 2023
1 parent 2e03743 commit 056b81d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/all-in-one/all_in_one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"encoding/json"
"io"
"net/http"
"strings"
"testing"
"time"

Expand All @@ -46,12 +47,13 @@ const (
agentURL = "http://" + agentHostPort

getServicesURL = queryURL + "/api/services"
getTraceURL = queryURL + "/api/traces?service=jaeger-query&tag=jaeger-debug-id:debug"
getSamplingStrategyURL = agentURL + "/sampling?service=whatever"

getServicesAPIV3URL = queryURL + "/api/v3/services"
)

var getTraceURL = queryURL + "/api/traces/"

var httpClient = &http.Client{
Timeout: time.Second,
}
Expand All @@ -70,10 +72,15 @@ func TestAllInOne(t *testing.T) {
func createTrace(t *testing.T) {
req, err := http.NewRequest(http.MethodGet, getServicesURL, nil)
require.NoError(t, err)
req.Header.Add("jaeger-debug-id", "debug")

resp, err := httpClient.Do(req)
require.NoError(t, err)
traceResponse := resp.Header.Get("traceresponse")
parts := strings.Split(traceResponse, "-")
traceID := parts[1]
req.Header.Set("trace-id", traceID)
// Update the URL with the traceID
getTraceURL += traceID
resp.Body.Close()
}

Expand Down Expand Up @@ -121,7 +128,7 @@ func getSamplingStrategy(t *testing.T) {
resp.Body.Close()

assert.NotNil(t, queryResponse.ProbabilisticSampling)
assert.EqualValues(t, 1.0, queryResponse.ProbabilisticSampling.SamplingRate)
assert.EqualValues(t, 0.001, queryResponse.ProbabilisticSampling.SamplingRate)
}

func healthCheck(t *testing.T) {
Expand Down

0 comments on commit 056b81d

Please sign in to comment.