diff --git a/bonsai/bonsai_impl_test.go b/bonsai/bonsai_impl_test.go new file mode 100644 index 0000000..39d6d1d --- /dev/null +++ b/bonsai/bonsai_impl_test.go @@ -0,0 +1,5 @@ +package bonsai + +func Pointer[T any](d T) *T { + return &d +} diff --git a/bonsai/bonsai_test.go b/bonsai/bonsai_test.go index c2ca0ba..04be1e5 100644 --- a/bonsai/bonsai_test.go +++ b/bonsai/bonsai_test.go @@ -8,10 +8,6 @@ import ( "path/filepath" ) -func Pointer[T any](d T) *T { - return &d -} - func init() { initLogger() } diff --git a/bonsai/plan_impl_test.go b/bonsai/plan_impl_test.go index 15b0ffe..e8b41b8 100644 --- a/bonsai/plan_impl_test.go +++ b/bonsai/plan_impl_test.go @@ -39,8 +39,8 @@ func (s *ClientImplTestSuite) TestPlanAllResponseJsonUnmarshal() { Name: "Sandbox", PriceInCents: 0, BillingIntervalInMonths: 1, - SingleTenant: new(bool), - PrivateNetwork: new(bool), + SingleTenant: Pointer(false), + PrivateNetwork: Pointer(false), AvailableReleases: []string{ "elasticsearch-7.2.0", }, diff --git a/bonsai/plan_test.go b/bonsai/plan_test.go index 457b318..ad0d38f 100644 --- a/bonsai/plan_test.go +++ b/bonsai/plan_test.go @@ -68,8 +68,8 @@ func (s *ClientMockTestSuite) TestPlanClient_All() { Name: "Sandbox", PriceInCents: 0, BillingIntervalInMonths: 1, - SingleTenant: new(bool), - PrivateNetwork: new(bool), + SingleTenant: bonsai.Pointer(false), + PrivateNetwork: bonsai.Pointer(false), AvailableReleases: []bonsai.Release{ // TODO: we'll see whether the response is actually a // shortened version like this or a slug @@ -92,8 +92,8 @@ func (s *ClientMockTestSuite) TestPlanClient_All() { Name: "Standard Small", PriceInCents: 5000, BillingIntervalInMonths: 1, - SingleTenant: Pointer(false), - PrivateNetwork: Pointer(false), + SingleTenant: bonsai.Pointer(false), + PrivateNetwork: bonsai.Pointer(false), AvailableReleases: []bonsai.Release{ {Slug: "elasticsearch-5.6.16"}, {Slug: "elasticsearch-6.8.3"}, @@ -155,8 +155,8 @@ func (s *ClientMockTestSuite) TestPlanClient_GetByPath() { Name: "Sandbox", PriceInCents: 0, BillingIntervalInMonths: 1, - SingleTenant: new(bool), - PrivateNetwork: new(bool), + SingleTenant: bonsai.Pointer(false), + PrivateNetwork: bonsai.Pointer(false), AvailableReleases: []bonsai.Release{ {Slug: "elasticsearch-7.2.0"}, }, diff --git a/bonsai/release_test.go b/bonsai/release_test.go index e629fb7..e08a88a 100644 --- a/bonsai/release_test.go +++ b/bonsai/release_test.go @@ -54,21 +54,21 @@ func (s *ClientMockTestSuite) TestReleaseClient_All() { Slug: "elasticsearch-5.6.16", ServiceType: "elasticsearch", Version: "5.6.16", - MultiTenant: Pointer(true), + MultiTenant: bonsai.Pointer(true), }, { Name: "Elasticsearch 6.5.4", Slug: "elasticsearch-6.5.4", ServiceType: "elasticsearch", Version: "6.5.4", - MultiTenant: Pointer(true), + MultiTenant: bonsai.Pointer(true), }, { Name: "Elasticsearch 7.2.0", Slug: "elasticsearch-7.2.0", ServiceType: "elasticsearch", Version: "7.2.0", - MultiTenant: Pointer(true), + MultiTenant: bonsai.Pointer(true), }, } releases, err := s.client.Release.All(context.Background()) @@ -108,7 +108,7 @@ func (s *ClientMockTestSuite) TestReleaseClient_GetBySlug() { Name: "Elasticsearch 7.2.0", ServiceType: "elasticsearch", Version: "7.2.0", - MultiTenant: Pointer(true), + MultiTenant: bonsai.Pointer(true), } resultResp, err := s.client.Release.GetBySlug(context.Background(), targetReleaseSlug) diff --git a/bonsai/space_test.go b/bonsai/space_test.go index 1785ce7..65a5746 100644 --- a/bonsai/space_test.go +++ b/bonsai/space_test.go @@ -92,7 +92,7 @@ func (s *ClientMockTestSuite) TestSpaceClient_GetByPath() { s.NoError(err, "successfully get space by path") s.Equal(targetSpacePath, space.Path) - s.Equal(new(bool), space.PrivateNetwork) + s.Equal(bonsai.Pointer(false), space.PrivateNetwork) s.Equal("aws", space.Cloud.Provider) s.Equal("aws-us-east-1", space.Cloud.Region) }