Skip to content

Commit

Permalink
Merge pull request #8 from omc/feat/cluster-client
Browse files Browse the repository at this point in the history
Cluster Client; update test router.
  • Loading branch information
momer authored May 3, 2024
2 parents e063e61 + fdb0a9e commit 7372fc0
Show file tree
Hide file tree
Showing 10 changed files with 1,022 additions and 17 deletions.
2 changes: 2 additions & 0 deletions bonsai/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ type Client struct {
Space SpaceClient
Plan PlanClient
Release ReleaseClient
Cluster ClusterClient
}

func NewClient(options ...ClientOption) *Client {
Expand All @@ -345,6 +346,7 @@ func NewClient(options ...ClientOption) *Client {
client.Space = SpaceClient{client}
client.Plan = PlanClient{client}
client.Release = ReleaseClient{client}
client.Cluster = ClusterClient{client}

return client
}
Expand Down
5 changes: 3 additions & 2 deletions bonsai/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

"github.com/go-chi/chi/v5"
"github.com/omc/bonsai-api-go/v1/bonsai"
)

Expand All @@ -34,7 +35,7 @@ type ClientTestSuite struct {
suite.Suite

// serveMux is the request multiplexer used for tests
serveMux *http.ServeMux
serveMux *chi.Mux
// server is the testing server on some local port
server *httptest.Server
// client allows each test to have a reachable *bonsai.Client for testing
Expand All @@ -43,7 +44,7 @@ type ClientTestSuite struct {

func (s *ClientTestSuite) SetupSuite() {
// Configure http client and other miscellany
s.serveMux = http.NewServeMux()
s.serveMux = chi.NewRouter()
s.server = httptest.NewServer(s.serveMux)
token, err := bonsai.NewToken("TestToken")
if err != nil {
Expand Down
Loading

0 comments on commit 7372fc0

Please sign in to comment.