From f20e251345da2bf5b97561af2eadda3ce7d0328f Mon Sep 17 00:00:00 2001 From: Rob Best Date: Fri, 22 Mar 2019 12:10:06 +0000 Subject: [PATCH] Add a few tests around the scheme parsing --- ssl_exporter_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ssl_exporter_test.go b/ssl_exporter_test.go index 658ebed..f7e8198 100644 --- a/ssl_exporter_test.go +++ b/ssl_exporter_test.go @@ -60,6 +60,12 @@ func TestProbeHandler(t *testing.T) { {uri: "client.badssl.com:443", ok: true, tlsConfig: &tls.Config{Certificates: []tls.Certificate{certificate}}}, // Test with an empty root CA bundle {uri: "google.com:443", ok: false, tlsConfig: &tls.Config{RootCAs: emptyRootCAs}}, + // Test with a https scheme + {uri: "https://google.com", ok: true, tlsConfig: &tls.Config{}}, + // Test with a https scheme and port + {uri: "https://google.com:443", ok: true, tlsConfig: &tls.Config{}}, + // Test with no scheme or port + {uri: "google.com", ok: true, tlsConfig: &tls.Config{}}, } fmt.Println("Note: The error logs in these tests are expected. One of the important tests is that we return the expected body, even in the face of errors.")