diff --git a/prometheus/prometheus.go b/prometheus/prometheus.go index 1768e7a..2101cf6 100644 --- a/prometheus/prometheus.go +++ b/prometheus/prometheus.go @@ -88,9 +88,6 @@ func (p *Prometheus) QueryRange(query string, start, end time.Time, step time.Du // Verifies prometheus connection func (p *Prometheus) verifyConnection() error { - _, err := p.api.Runtimeinfo(context.TODO()) - if err != nil { - return err - } - return nil + _, err := p.Query("up{}", time.Now().UTC().UTC()) + return err } diff --git a/prometheus/prometheus_test.go b/prometheus/prometheus_test.go index 69f2c36..cd32c6b 100644 --- a/prometheus/prometheus_test.go +++ b/prometheus/prometheus_test.go @@ -101,7 +101,7 @@ var _ = Describe("Tests for Prometheus", func() { _, err := NewClient(url, token, username, password, tlsSkipVerify) //Asserting no of times mocks are called Expect(count).To(BeEquivalentTo(0)) - Expect(err.Error()).To(ContainSubstring("Get \"/api/v1/status/runtimeinfo\": unsupported protocol scheme \"\"")) + Expect(err.Error()).To(ContainSubstring("Post \"/api/v1/query\": unsupported protocol scheme \"\"")) }) It("Test2 passing not valid url", func() {