Skip to content

Commit

Permalink
DX: omit empty fields like 'private_network' which have an empty valu…
Browse files Browse the repository at this point in the history
…e which can mislead users
  • Loading branch information
momer committed May 15, 2024
1 parent 69dd640 commit 285872e
Show file tree
Hide file tree
Showing 28 changed files with 326 additions and 1,199 deletions.
4 changes: 4 additions & 0 deletions bonsai/bonsai_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (
"path/filepath"
)

func Pointer[T any](d T) *T {
return &d
}

func init() {
initLogger()
}
Expand Down
4 changes: 2 additions & 2 deletions bonsai/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func (s *ClientVCRTestSuite) TestClusterClient_Create() {
func (s *ClientVCRTestSuite) TestClusterClient_Update() {
ctx := context.Background()

plan, err := s.client.Cluster.Update(ctx, "bonsai-api-go-2471463249", bonsai.ClusterUpdateOpts{
plan, err := s.client.Cluster.Update(ctx, "bonsai-api-go-5431547241", bonsai.ClusterUpdateOpts{
Name: "bonsai-api-go-test-cluster-updated",
Plan: "standard-nano-comped",
})
Expand All @@ -504,7 +504,7 @@ func (s *ClientVCRTestSuite) TestClusterClient_Update() {
func (s *ClientVCRTestSuite) TestClusterClient_Delete() {
ctx := context.Background()

plan, err := s.client.Cluster.Destroy(ctx, "bonsai-api-go-9994392953")
plan, err := s.client.Cluster.Destroy(ctx, "bonsai-api-go-5431547241")
s.NoError(err, "successfully get cluster")
assertGolden(s, plan)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
[
{
"slug": "bonsai-api-go-3216591042",
"name": "bonsai-api-go-test-cluster-updated",
"uri": "https://api.bonsai.io/clusters/bonsai-api-go-3216591042",
"plan": {
"slug": "standard-nano-comped",
"available_releases": [],
"available_spaces": [],
"uri": "https://api.bonsai.io/plans/standard-nano-comped"
},
"release": {
"slug": "opensearch-2.6.0-mt",
"service_type": "opensearch",
"version": "2.6.0",
"uri": "https://api.bonsai.io/releases/opensearch-2.6.0-mt",
"package_name": "2.6.0-mt"
},
"space": {
"path": "omc/bonsai/us-east-1/common",
"region": "aws-us-east-1",
"uri": "https://api.bonsai.io/spaces/omc/bonsai/us-east-1/common"
},
"stats": {},
"access": {
"host": "bonsai-api-go-3216591042.us-east-1.bonsaisearch.net",
"port": 443,
"scheme": "https"
},
"state": "PROVISIONED"
},
{
"slug": "dcek-group-llc-5240651189",
"name": "DCEK Group, LLC search",
Expand All @@ -18,11 +48,6 @@
},
"space": {
"path": "omc/bonsai/us-east-1/common",
"private_network": false,
"cloud": {
"provider": "",
"region": ""
},
"region": "aws-us-east-1",
"uri": "https://api.bonsai.io/spaces/omc/bonsai/us-east-1/common"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"message": "Your cluster is being provisioned.",
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-2471463249",
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-5431547241",
"access": {
"host": "bonsai-api-go-2471463249",
"host": "bonsai-api-go-5431547241",
"port": 443,
"scheme": "https",
"user": "REDACTED",
"pass": "REDACTED",
"url": "://REDACTED:REDACTED"
"url": "://REDACTED:REDACTED@"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"message": "Your cluster is being deprovisioned.",
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-9994392953"
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-5431547241"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
},
"space": {
"path": "omc/bonsai/us-east-1/common",
"private_network": false,
"cloud": {
"provider": "",
"region": ""
},
"region": "aws-us-east-1",
"uri": "https://api.bonsai.io/spaces/omc/bonsai/us-east-1/common"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"message": "Your cluster is being updated.",
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-2471463249"
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-5431547241"
}
Loading

0 comments on commit 285872e

Please sign in to comment.