Skip to content

Commit e80bbdf

Browse files
committed
fix e2e test failures
1 parent 2d60a53 commit e80bbdf

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ func main() {
301301

302302
stdlog.Println(version.Info())
303303

304-
if !cfg.metrics.enabled && !cfg.logs.enabled && !cfg.traces.enabled {
305-
stdlog.Fatal("Neither logging, metrics not traces endpoints are enabled. " +
306-
"Specifying at least a logging or a metrics endpoint is mandatory")
304+
if !cfg.metrics.enabled && !cfg.logs.enabled && !cfg.traces.enabled && !cfg.probes.enabled {
305+
stdlog.Fatal("Neither logging, metrics, traces, nor probes endpoints are enabled. " +
306+
"Specifying at least one endpoint is mandatory")
307307
}
308308

309309
logger := logger.NewLogger(cfg.logLevel, cfg.logFormat, cfg.debug.name)

test/e2e/probes_test.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ func TestProbes_CreateAndGetProbe(t *testing.T) {
2929
e,
3030
withProbesEndpoint("http://"+probesEndpoint),
3131
withRateLimiter(rateLimiterAddr),
32+
withMetricsEndpoints("http://dummy-metrics:9090", "http://dummy-metrics:9090"), // Add minimal metrics endpoints since probes are mounted within metrics route group
3233
)
3334
testutil.Ok(t, err)
3435
testutil.Ok(t, e2e.StartAndWaitReady(api))
@@ -47,7 +48,7 @@ func TestProbes_CreateAndGetProbe(t *testing.T) {
4748
payloadBytes, err := json.Marshal(probePayload)
4849
testutil.Ok(t, err)
4950

50-
createURL := fmt.Sprintf("https://%s/api/probes/v1/%s/probes", api.InternalEndpoint("https"), defaultTenantName)
51+
createURL := fmt.Sprintf("https://%s/api/metrics/v1/%s/probes", api.Endpoint("https"), defaultTenantName)
5152
req, err := http.NewRequest("POST", createURL, bytes.NewBuffer(payloadBytes))
5253
testutil.Ok(t, err)
5354
req.Header.Set("Authorization", "Bearer "+token)
@@ -77,7 +78,7 @@ func TestProbes_CreateAndGetProbe(t *testing.T) {
7778
testutil.Assert(t, probeID != "", "probe ID should not be empty")
7879

7980
// Get probe by ID
80-
getURL := fmt.Sprintf("https://%s/api/probes/v1/%s/probes/%s", api.InternalEndpoint("https"), defaultTenantName, probeID)
81+
getURL := fmt.Sprintf("https://%s/api/metrics/v1/%s/probes/%s", api.Endpoint("https"), defaultTenantName, probeID)
8182
getReq, err := http.NewRequest("GET", getURL, nil)
8283
testutil.Ok(t, err)
8384
getReq.Header.Set("Authorization", "Bearer "+token)
@@ -126,6 +127,7 @@ func TestProbes_ListProbes(t *testing.T) {
126127
e,
127128
withProbesEndpoint("http://"+probesEndpoint),
128129
withRateLimiter(rateLimiterAddr),
130+
withMetricsEndpoints("http://dummy-metrics:9090", "http://dummy-metrics:9090"), // Add minimal metrics endpoints since probes are mounted within metrics route group
129131
)
130132
testutil.Ok(t, err)
131133
testutil.Ok(t, e2e.StartAndWaitReady(api))
@@ -150,7 +152,7 @@ func TestProbes_ListProbes(t *testing.T) {
150152
payloadBytes, err := json.Marshal(probePayload)
151153
testutil.Ok(t, err)
152154

153-
createURL := fmt.Sprintf("https://%s/api/probes/v1/%s/probes", api.InternalEndpoint("https"), defaultTenantName)
155+
createURL := fmt.Sprintf("https://%s/api/metrics/v1/%s/probes", api.Endpoint("https"), defaultTenantName)
154156
req, err := http.NewRequest("POST", createURL, bytes.NewBuffer(payloadBytes))
155157
testutil.Ok(t, err)
156158
req.Header.Set("Authorization", "Bearer "+token)
@@ -163,7 +165,7 @@ func TestProbes_ListProbes(t *testing.T) {
163165
}
164166

165167
// List all probes
166-
listURL := fmt.Sprintf("https://%s/api/probes/v1/%s/probes", api.InternalEndpoint("https"), defaultTenantName)
168+
listURL := fmt.Sprintf("https://%s/api/metrics/v1/%s/probes", api.Endpoint("https"), defaultTenantName)
167169
listReq, err := http.NewRequest("GET", listURL, nil)
168170
testutil.Ok(t, err)
169171
listReq.Header.Set("Authorization", "Bearer "+token)
@@ -184,7 +186,7 @@ func TestProbes_ListProbes(t *testing.T) {
184186
testutil.Assert(t, len(probes) >= 2, "should have at least 2 probes")
185187

186188
// Test label selector filtering
187-
filterURL := fmt.Sprintf("https://%s/api/probes/v1/%s/probes?label_selector=env=prod", api.InternalEndpoint("https"), defaultTenantName)
189+
filterURL := fmt.Sprintf("https://%s/api/metrics/v1/%s/probes?label_selector=env=prod", api.Endpoint("https"), defaultTenantName)
188190
filterReq, err := http.NewRequest("GET", filterURL, nil)
189191
testutil.Ok(t, err)
190192
filterReq.Header.Set("Authorization", "Bearer "+token)
@@ -225,6 +227,7 @@ func TestProbes_CreateProbeConflict(t *testing.T) {
225227
e,
226228
withProbesEndpoint("http://"+probesEndpoint),
227229
withRateLimiter(rateLimiterAddr),
230+
withMetricsEndpoints("http://dummy-metrics:9090", "http://dummy-metrics:9090"), // Add minimal metrics endpoints since probes are mounted within metrics route group
228231
)
229232
testutil.Ok(t, err)
230233
testutil.Ok(t, e2e.StartAndWaitReady(api))
@@ -247,7 +250,7 @@ func TestProbes_CreateProbeConflict(t *testing.T) {
247250
payloadBytes, err := json.Marshal(probePayload)
248251
testutil.Ok(t, err)
249252

250-
createURL := fmt.Sprintf("https://%s/api/probes/v1/%s/probes", api.InternalEndpoint("https"), defaultTenantName)
253+
createURL := fmt.Sprintf("https://%s/api/metrics/v1/%s/probes", api.Endpoint("https"), defaultTenantName)
251254

252255
// Create first probe
253256
req1, err := http.NewRequest("POST", createURL, bytes.NewBuffer(payloadBytes))
@@ -290,6 +293,7 @@ func TestProbes_UnauthorizedAccess(t *testing.T) {
290293
e,
291294
withProbesEndpoint("http://"+probesEndpoint),
292295
withRateLimiter(rateLimiterAddr),
296+
withMetricsEndpoints("http://dummy-metrics:9090", "http://dummy-metrics:9090"), // Add minimal metrics endpoints since probes are mounted within metrics route group
293297
)
294298
testutil.Ok(t, err)
295299
testutil.Ok(t, e2e.StartAndWaitReady(api))
@@ -302,7 +306,7 @@ func TestProbes_UnauthorizedAccess(t *testing.T) {
302306
}
303307

304308
// Test without authorization header
305-
listURL := fmt.Sprintf("https://%s/api/probes/v1/%s/probes", api.InternalEndpoint("https"), defaultTenantName)
309+
listURL := fmt.Sprintf("https://%s/api/metrics/v1/%s/probes", api.Endpoint("https"), defaultTenantName)
306310
req, err := http.NewRequest("GET", listURL, nil)
307311
testutil.Ok(t, err)
308312
// Deliberately not setting Authorization header

0 commit comments

Comments
 (0)