Skip to content

Commit

Permalink
Merge pull request #42 from rsevilla87/update-prometheus-connection-v…
Browse files Browse the repository at this point in the history
…erify

Update verify connection API call
  • Loading branch information
vishnuchalla authored Feb 21, 2024
2 parents 33ff998 + d851906 commit 0140b10
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion prometheus/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 0140b10

Please sign in to comment.