forked from argoproj/argo-workflows
/
metrics_test.go
48 lines (38 loc) · 986 Bytes
/
metrics_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// +build e2e
package e2e
import (
"testing"
"github.com/gavv/httpexpect/v2"
"github.com/stretchr/testify/suite"
"github.com/argoproj/argo/test/e2e/fixtures"
)
const baseUrlMetrics = "http://localhost:9090/metrics"
// ensure basic HTTP functionality works,
// testing behaviour really is a non-goal
type MetricsSuite struct {
fixtures.E2ESuite
}
func (s *MetricsSuite) BeforeTest(suiteName, testName string) {
s.E2ESuite.BeforeTest(suiteName, testName)
}
func (s *MetricsSuite) e(t *testing.T) *httpexpect.Expect {
return httpexpect.
WithConfig(httpexpect.Config{
BaseURL: baseUrlMetrics,
Reporter: httpexpect.NewRequireReporter(t),
Printers: []httpexpect.Printer{
httpexpect.NewDebugPrinter(&httpLogger{}, true),
},
Client: httpClient,
})
}
func (s *MetricsSuite) TestMetricsEndpoint() {
s.Run("Metrics", func() {
s.e(s.T()).GET("").
Expect().
Status(200)
})
}
func TestMetricsSuite(t *testing.T) {
suite.Run(t, new(MetricsSuite))
}