Skip to content

Commit 45edd8a

Browse files
authored
Merge pull request #1770 from prometheus/superq/update_test_url
Update example test
2 parents e575c9c + 93a67cb commit 45edd8a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

api/prometheus/v1/example_test.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ import (
2828
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
2929
)
3030

31+
const DemoPrometheusURL = "https://demo.prometheus.io:443"
32+
3133
func ExampleAPI_query() {
3234
client, err := api.NewClient(api.Config{
33-
Address: "http://demo.robustperception.io:9090",
35+
Address: DemoPrometheusURL,
3436
})
3537
if err != nil {
3638
fmt.Printf("Error creating client: %v\n", err)
@@ -53,7 +55,7 @@ func ExampleAPI_query() {
5355

5456
func ExampleAPI_queryRange() {
5557
client, err := api.NewClient(api.Config{
56-
Address: "http://demo.robustperception.io:9090",
58+
Address: DemoPrometheusURL,
5759
})
5860
if err != nil {
5961
fmt.Printf("Error creating client: %v\n", err)
@@ -104,7 +106,7 @@ func (u userAgentRoundTripper) RoundTrip(r *http.Request) (*http.Response, error
104106

105107
func ExampleAPI_queryRangeWithUserAgent() {
106108
client, err := api.NewClient(api.Config{
107-
Address: "http://demo.robustperception.io:9090",
109+
Address: DemoPrometheusURL,
108110
RoundTripper: userAgentRoundTripper{name: "Client-Golang", rt: api.DefaultRoundTripper},
109111
})
110112
if err != nil {
@@ -133,7 +135,7 @@ func ExampleAPI_queryRangeWithUserAgent() {
133135

134136
func ExampleAPI_queryRangeWithBasicAuth() {
135137
client, err := api.NewClient(api.Config{
136-
Address: "http://demo.robustperception.io:9090",
138+
Address: DemoPrometheusURL,
137139
// We can use amazing github.com/prometheus/common/config helper!
138140
RoundTripper: config.NewBasicAuthRoundTripper(
139141
config.NewInlineSecret("me"),
@@ -167,7 +169,7 @@ func ExampleAPI_queryRangeWithBasicAuth() {
167169

168170
func ExampleAPI_queryRangeWithAuthBearerToken() {
169171
client, err := api.NewClient(api.Config{
170-
Address: "http://demo.robustperception.io:9090",
172+
Address: DemoPrometheusURL,
171173
// We can use amazing github.com/prometheus/common/config helper!
172174
RoundTripper: config.NewAuthorizationCredentialsRoundTripper(
173175
"Bearer",
@@ -201,7 +203,7 @@ func ExampleAPI_queryRangeWithAuthBearerToken() {
201203

202204
func ExampleAPI_queryRangeWithAuthBearerTokenHeadersRoundTripper() {
203205
client, err := api.NewClient(api.Config{
204-
Address: "http://demo.robustperception.io:9090",
206+
Address: DemoPrometheusURL,
205207
// We can use amazing github.com/prometheus/common/config helper!
206208
RoundTripper: config.NewHeadersRoundTripper(
207209
&config.Headers{
@@ -240,7 +242,7 @@ func ExampleAPI_queryRangeWithAuthBearerTokenHeadersRoundTripper() {
240242

241243
func ExampleAPI_series() {
242244
client, err := api.NewClient(api.Config{
243-
Address: "http://demo.robustperception.io:9090",
245+
Address: DemoPrometheusURL,
244246
})
245247
if err != nil {
246248
fmt.Printf("Error creating client: %v\n", err)

0 commit comments

Comments
 (0)