From c231950cdb584e9484f6aa0c7424aaf9ac919f4b Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Fri, 24 Feb 2017 14:30:26 -0800 Subject: [PATCH] clientv3: use any port for metrics example Was getting bind conflicts causing failures on semaphore. --- clientv3/example_metrics_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clientv3/example_metrics_test.go b/clientv3/example_metrics_test.go index 6df797a44fc..21c5f07a6de 100644 --- a/clientv3/example_metrics_test.go +++ b/clientv3/example_metrics_test.go @@ -47,7 +47,7 @@ func ExampleMetrics_range() { cli.Get(context.TODO(), "test_key") // listen for all prometheus metrics - ln, err := net.Listen("tcp", ":47989") + ln, err := net.Listen("tcp", ":0") if err != nil { log.Fatal(err) } @@ -62,7 +62,7 @@ func ExampleMetrics_range() { }() // make an http request to fetch all prometheus metrics - url := "http://localhost:47989/metrics" + url := "http://" + ln.Addr().String() + "/metrics" resp, err := http.Get(url) if err != nil { log.Fatalf("fetch error: %v", err)