Skip to content

Commit

Permalink
remove unnecessary httpclient test
Browse files Browse the repository at this point in the history
  • Loading branch information
bcmdarroch committed Dec 16, 2022
1 parent bd592c9 commit 1ad9e50
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions httpclient/httpclient_test.go
Expand Up @@ -105,39 +105,6 @@ func TestNew(t *testing.T) {
require.Equal(t, uint32(2), atomic.LoadUint32(&numRequests))
})

t.Run("legacy configuration, no source channel", func(t *testing.T) {
numRequests = 0

cfg := Config{
HostPath: ts.URL,
AuthURL: ts.URL,
ClientID: clientID,
ClientSecret: clientSecret,
// Override the base http.Client so that we trust the test server's TLS
Client: ts.Client(),
}

// The test's important assertions occur in the test server handler above.
// When an http client is initialized, it tries to obtain an access token using the configured token URL (from an auth provider), client ID, and client secret.
// The token request embedded in this client initializer hits the mock auth provider handler above ('/oauth/token').
cl, err := New(cfg)
require.NoError(t, err)

consulClient := consul.New(cl, nil)
listParams := consul.NewListParams()
listParams.LocationOrganizationID = orgID
listParams.LocationProjectID = projID

// This SDK request hits the mock Consul List API handler above ('/consul/2021-02-04/organizations...').
// The handler verifies that the expected bearer token is provided.
_, err = consulClient.List(listParams, nil)
require.NoError(t, err)

// Make sure we actually handled both the auth and the GET request and didn't
// just skip all the assertions!
require.Equal(t, uint32(2), atomic.LoadUint32(&numRequests))
})

t.Run("HCPConfig", func(t *testing.T) {
numRequests = 0

Expand Down

0 comments on commit 1ad9e50

Please sign in to comment.