Skip to content

Commit 52fc5d3

Browse files
pipiland2612yurishkuro
authored andcommitted
Add e2e integration test for Query Service (jaegertracing#6966)
## Which problem is this PR solving? - part of jaegertracing#6683 ## Description of the changes - Add new e2e integration tests to exercise jaeger-query.yaml configuration - Add configure e2e pipeline ## How was this change tested? - `STORAGE=query SPAN_STORAGE_TYPE=memory make jaeger-v2-storage-integration-test ` command runs successfully locally ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] 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: pipiland <[email protected]> Signed-off-by: pipiland <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]> Signed-off-by: amol-verma-allen <[email protected]>
1 parent b21764b commit 52fc5d3

File tree

6 files changed

+113
-15
lines changed

6 files changed

+113
-15
lines changed

.github/workflows/ci-e2e-query.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CIT Query
2+
3+
on:
4+
workflow_call:
5+
6+
concurrency:
7+
group: cit-query-${{ github.workflow }}-${{ (github.event.pull_request && github.event.pull_request.number) || github.ref || github.run_id }}
8+
cancel-in-progress: true
9+
10+
# See https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
11+
permissions: # added using https://github.com/step-security/secure-workflows
12+
contents: read
13+
14+
jobs:
15+
query:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Harden Runner
19+
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
20+
with:
21+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
22+
23+
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
24+
25+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
26+
with:
27+
go-version: 1.24.x
28+
29+
- name: Run Memory storage integration tests
30+
run: |
31+
STORAGE=query SPAN_STORAGE_TYPE=memory make jaeger-v2-storage-integration-test
32+
33+
- name: Upload coverage to codecov
34+
uses: ./.github/actions/upload-codecov
35+
with:
36+
files: cover.out
37+
flags: query

cmd/jaeger/config-query.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ extensions:
3636
jaeger_storage:
3737
backends:
3838
query_storage:
39-
memory:
40-
max_traces: 100000
39+
grpc:
40+
endpoint: localhost:17271
41+
tls:
42+
insecure: true
4143

4244
receivers:
4345
nop:

cmd/jaeger/config-remote-storage.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ extensions:
3232
traces_archive: another-storage
3333
ui:
3434
config_file: ./cmd/jaeger/config-ui.json
35-
35+
grpc:
36+
endpoint: "${env:JAEGER_QUERY_GRPC_ENDPOINT:-localhost:16685}"
37+
http:
38+
endpoint: "${env:JAEGER_QUERY_HTTP_ENDPOINT:-localhost:16686}"
3639
jaeger_storage:
3740
backends:
3841
some-storage:

cmd/jaeger/internal/integration/e2e_integration.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ type E2EStorageIntegration struct {
4242
SkipStorageCleaner bool
4343
ConfigFile string
4444
BinaryName string
45-
HealthCheckPort int // overridable for Kafka tests which run two binaries and need different ports
45+
46+
MetricsPort int // overridable, default to 8888
47+
HealthCheckPort int // overridable for tests (e.g. Kafka, query) which run two binaries and need different ports
4648

4749
// EnvVarOverrides contains a map of environment variables to set.
4850
// The key in the map is the environment variable to override and the value
@@ -99,14 +101,20 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) {
99101
require.NoError(t, err)
100102

101103
t.Cleanup(func() {
102-
scrapeMetrics(t, storage)
104+
s.scrapeMetrics(t, storage)
103105
require.NoError(t, s.TraceReader.(io.Closer).Close())
104106
require.NoError(t, s.TraceWriter.(io.Closer).Close())
105107
})
106108
}
107109

108-
func scrapeMetrics(t *testing.T, storage string) {
109-
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, "http://localhost:8888/metrics", nil)
110+
func (s *E2EStorageIntegration) scrapeMetrics(t *testing.T, storage string) {
111+
metricsPort := 8888
112+
if s.MetricsPort != 0 {
113+
metricsPort = s.MetricsPort
114+
}
115+
metricsUrl := fmt.Sprintf("http://localhost:%d/metrics", metricsPort)
116+
117+
req, err := http.NewRequestWithContext(context.Background(), http.MethodGet, metricsUrl, nil)
110118
require.NoError(t, err)
111119

112120
client := &http.Client{}

cmd/jaeger/internal/integration/grpc_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ type GRPCStorageIntegration struct {
1717
archiveRemoteStorage *integration.RemoteMemoryStorage
1818
}
1919

20-
func (s *GRPCStorageIntegration) initialize(t *testing.T) {
20+
func (s *GRPCStorageIntegration) initializeRemoteStorages(t *testing.T) {
2121
s.remoteStorage = integration.StartNewRemoteMemoryStorage(t, ports.RemoteStorageGRPC)
2222
s.archiveRemoteStorage = integration.StartNewRemoteMemoryStorage(t, ports.RemoteStorageGRPC+1)
2323
}
2424

25-
func (s *GRPCStorageIntegration) cleanUp(t *testing.T) {
25+
func (s *GRPCStorageIntegration) closeRemoteStorages(t *testing.T) {
2626
s.remoteStorage.Close(t)
2727
s.archiveRemoteStorage.Close(t)
28-
s.initialize(t)
28+
}
29+
30+
func (s *GRPCStorageIntegration) cleanUp(t *testing.T) {
31+
s.closeRemoteStorages(t)
32+
s.initializeRemoteStorages(t)
2933
}
3034

3135
func TestGRPCStorage(t *testing.T) {
@@ -38,11 +42,8 @@ func TestGRPCStorage(t *testing.T) {
3842
},
3943
}
4044
s.CleanUp = s.cleanUp
41-
s.initialize(t)
45+
s.initializeRemoteStorages(t)
4246
s.e2eInitialize(t, "grpc")
43-
t.Cleanup(func() {
44-
s.remoteStorage.Close(t)
45-
s.archiveRemoteStorage.Close(t)
46-
})
47+
t.Cleanup(func() { s.closeRemoteStorages(t) })
4748
s.RunSpanStoreTests(t)
4849
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) 2025 The Jaeger Authors.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package integration
5+
6+
import (
7+
"testing"
8+
9+
"github.com/jaegertracing/jaeger/internal/storage/integration"
10+
)
11+
12+
func TestJaegerQueryService(t *testing.T) {
13+
integration.SkipUnlessEnv(t, "query")
14+
15+
// Start instance of Jaeger with jaeger_query reading from Remote Storage, which
16+
// will be started in GRPCStorageIntegration below
17+
query := &E2EStorageIntegration{
18+
ConfigFile: "../../config-query.yaml",
19+
SkipStorageCleaner: true,
20+
// referencing values in config-query.yaml
21+
HealthCheckPort: 12133,
22+
MetricsPort: 8887,
23+
}
24+
query.e2eInitialize(t, "grpc")
25+
t.Log("Query initialized")
26+
27+
// Start another instance of Jaeger receiving traces and write traces to Remote Storage
28+
collector := &GRPCStorageIntegration{
29+
E2EStorageIntegration: E2EStorageIntegration{
30+
ConfigFile: "../../config-remote-storage.yaml",
31+
SkipStorageCleaner: true,
32+
EnvVarOverrides: map[string]string{
33+
// Run jaeger_query on different ports here to avoid conflict
34+
// with jaeger_query instance of Jaeger above
35+
"JAEGER_QUERY_GRPC_ENDPOINT": "localhost:0",
36+
"JAEGER_QUERY_HTTP_ENDPOINT": "localhost:0",
37+
},
38+
},
39+
}
40+
collector.CleanUp = collector.cleanUp
41+
collector.initializeRemoteStorages(t)
42+
collector.e2eInitialize(t, "grpc")
43+
t.Cleanup(func() { collector.closeRemoteStorages(t) })
44+
t.Log("Collector initialized")
45+
46+
collector.RunSpanStoreTests(t)
47+
}

0 commit comments

Comments
 (0)