Skip to content

Commit

Permalink
Fix GCE unit tests with juju/http client.
Browse files Browse the repository at this point in the history
  • Loading branch information
hpidcock committed May 30, 2021
1 parent 99bdc80 commit f2ed4c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions provider/gce/google/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package google

import (
"context"
"net/http"

jujuhttp "github.com/juju/http/v2"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
)
Expand All @@ -18,7 +18,7 @@ type authSuite struct {
var _ = gc.Suite(&authSuite{})

func (s *authSuite) TestNewComputeService(c *gc.C) {
_, err := newComputeService(context.TODO(), s.Credentials, http.DefaultClient)
_, err := newComputeService(context.TODO(), s.Credentials, jujuhttp.NewClient())
c.Assert(err, jc.ErrorIsNil)
}

Expand Down
5 changes: 2 additions & 3 deletions provider/gce/google/config_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
package google_test

import (
"net/http"

jujuhttp "github.com/juju/http/v2"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

Expand All @@ -22,7 +21,7 @@ func (*connConfigSuite) TestValidateValid(c *gc.C) {
cfg := google.ConnectionConfig{
Region: "spam",
ProjectID: "eggs",
HTTPClient: http.DefaultClient,
HTTPClient: jujuhttp.NewClient(),
}
err := cfg.Validate()

Expand Down
4 changes: 2 additions & 2 deletions provider/gce/google/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package google_test

import (
"context"
"net/http"

"github.com/juju/errors"
jujuhttp "github.com/juju/http/v2"
jc "github.com/juju/testing/checkers"
"google.golang.org/api/compute/v1"
gc "gopkg.in/check.v1"
Expand All @@ -24,7 +24,7 @@ var _ = gc.Suite(&connSuite{})
func (s *connSuite) TestConnect(c *gc.C) {
google.SetRawConn(s.Conn, nil)
service := &compute.Service{}
s.PatchValue(google.NewService, func(ctx context.Context, creds *google.Credentials, httpClient *http.Client) (*compute.Service, error) {
s.PatchValue(google.NewService, func(ctx context.Context, creds *google.Credentials, httpClient *jujuhttp.Client) (*compute.Service, error) {
return service, nil
})

Expand Down
5 changes: 2 additions & 3 deletions provider/gce/google/testing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
package google

import (
"net/http"

jujuhttp "github.com/juju/http/v2"
"google.golang.org/api/compute/v1"
gc "gopkg.in/check.v1"

Expand Down Expand Up @@ -55,7 +54,7 @@ func (s *BaseSuite) SetUpTest(c *gc.C) {
s.ConnCfg = ConnectionConfig{
Region: "a",
ProjectID: "spam",
HTTPClient: http.DefaultClient,
HTTPClient: jujuhttp.NewClient(),
}
fake := &fakeConn{}
s.Conn = &Connection{
Expand Down

0 comments on commit f2ed4c6

Please sign in to comment.