github.com/kubeshop/testkube@v1.17.23/pkg/http/client_test.go (about)

     1  package http
     2  
     3  import (
     4  	"net/http"
     5  	"testing"
     6  	"time"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestNewClient(t *testing.T) {
    12  
    13  	t.Run("returns new client instance with configured timeouts correctly", func(t *testing.T) {
    14  		// given / when
    15  		c := NewClient()
    16  
    17  		// then
    18  		assert.Equal(t, ClientTimeout, c.Timeout)
    19  		assert.Equal(t, TLSHandshakeTimeout, c.Transport.(*http.Transport).TLSHandshakeTimeout)
    20  	})
    21  
    22  	t.Run("returns new SSE client with a hour timeout", func(t *testing.T) {
    23  		// given / when
    24  		c := NewSSEClient()
    25  
    26  		// then
    27  		assert.Equal(t, time.Hour, c.Timeout)
    28  	})
    29  }