Commit f574d15 1 parent c1a5560 commit f574d15 Copy full SHA for f574d15
File tree 1 file changed +42
-0
lines changed
test/e2e/scenarios/hubble
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ //go:build e2e
2
+ // +build e2e
3
+
4
+ package hubble
5
+
6
+ import (
7
+ "context"
8
+ "testing"
9
+
10
+ "github.com/prometheus/client_golang/api"
11
+ promv1 "github.com/prometheus/client_golang/api/prometheus/v1"
12
+ "github.com/stretchr/testify/require"
13
+ )
14
+
15
+ const (
16
+ promHubbleJob = "hubble-pods"
17
+ )
18
+
19
+ func TestPrometheusQuery (t * testing.T ) {
20
+ client , err := api .NewClient (api.Config {
21
+ Address : "http://localhost:9090" ,
22
+ })
23
+
24
+ require .NoError (t , err )
25
+ promapi := promv1 .NewAPI (client )
26
+ ctx := context .Background ()
27
+ targets , err := promapi .Targets (ctx )
28
+ require .NoError (t , err )
29
+ require .NotNil (t , targets )
30
+
31
+ hubbleActiveTarget := & promv1.ActiveTarget {
32
+ ScrapePool : promHubbleJob ,
33
+ Health : "up" ,
34
+ }
35
+
36
+ for _ , target := range targets .Active {
37
+ if target .ScrapePool == hubbleActiveTarget .ScrapePool {
38
+ require .Equal (t , hubbleActiveTarget .Health , hubbleActiveTarget .Health )
39
+ break
40
+ }
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments