From 3650a6aa97a14971bee7e1f8c27b07bdcb1081dd Mon Sep 17 00:00:00 2001 From: ArthurHlt Date: Sat, 11 Dec 2021 16:12:59 +0100 Subject: [PATCH] fix tests --- clients/backend_test.go | 2 +- scrapers/scrape_test.go | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/clients/backend_test.go b/clients/backend_test.go index b022dcf..8efc6f0 100644 --- a/clients/backend_test.go +++ b/clients/backend_test.go @@ -34,7 +34,7 @@ var _ = Describe("Backend", func() { httpTrans, ok := client.Transport.(*http.Transport) Expect(ok).To(BeTrue()) - Expect(httpTrans.TLSClientConfig.ServerName).To(Equal("my.san")) + Expect(httpTrans.TLSClientConfig.ServerName).To(Equal("")) Expect(httpTrans.MaxIdleConns).To(Equal(100)) Expect(httpTrans.MaxIdleConnsPerHost).To(Equal(100)) }) diff --git a/scrapers/scrape_test.go b/scrapers/scrape_test.go index 77fea32..2f1e82a 100644 --- a/scrapers/scrape_test.go +++ b/scrapers/scrape_test.go @@ -3,8 +3,10 @@ package scrapers_test import ( "fmt" "io/ioutil" + "net" "net/http" "net/url" + "strconv" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -51,12 +53,18 @@ var _ = Describe("Scraper", func() { }) It("scrapes metrics from an app", func() { + host, portStr, err := net.SplitHostPort(serverURL.Host) + Expect(err).ShouldNot(HaveOccurred()) + port, err := strconv.Atoi(portStr) + Expect(err).ShouldNot(HaveOccurred()) route := &models.Route{ - ID: "a758f25d-2d01-419e-b63b-de3aabcd9e15", - Address: serverURL.Host, + ID: "a758f25d-2d01-419e-b63b-de3aabcd9e15", + Address: host, + ServiceAddress: host, + ServicePort: port, } - resp, err := scraper.Scrape(route, "", "http", http.Header{}) + resp, err := scraper.Scrape(route, "/metrics", "http", http.Header{}) Expect(err).ShouldNot(HaveOccurred()) defer resp.Close()