summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/pkg/web/client_test.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/go/collectors/go.d.plugin/pkg/web/client_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/pkg/web/client_test.go b/src/go/collectors/go.d.plugin/pkg/web/client_test.go
new file mode 100644
index 000000000..ead1486c3
--- /dev/null
+++ b/src/go/collectors/go.d.plugin/pkg/web/client_test.go
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package web
+
+import (
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestNewHTTPClient(t *testing.T) {
+ client, _ := NewHTTPClient(Client{
+ Timeout: Duration(time.Second * 5),
+ NotFollowRedirect: true,
+ ProxyURL: "http://127.0.0.1:3128",
+ })
+
+ assert.IsType(t, (*http.Client)(nil), client)
+ assert.Equal(t, time.Second*5, client.Timeout)
+ assert.NotNil(t, client.CheckRedirect)
+}