Skip to content

Commit f2d4a25

Browse files
authored
CLOUDP-272624: fixed example (#431)
1 parent 3449467 commit f2d4a25

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

.github/workflows/pr.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-go@v5
1616
with:
17-
go-version-file: 'go.mod'
17+
go-version-file: go.mod
1818
cache: false # see https://github.com/golangci/golangci-lint-action/issues/807
1919
- name: lint
2020
uses: golangci/[email protected]
@@ -23,6 +23,8 @@ jobs:
2323
args: --timeout=10m
2424
- name: tests
2525
run: make test
26+
- name: example-tests
27+
run: make test-examples
2628

2729
build:
2830
needs: code-health # only run if code-health passes
@@ -32,7 +34,7 @@ jobs:
3234
- uses: actions/setup-node@v4
3335
with:
3436
node-version: 18
35-
cache: 'npm'
37+
cache: npm
3638
cache-dependency-path: ./tools/package-lock.json
3739
- working-directory: ./tools
3840
run: |

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ build:
2121
test:
2222
go test $(SOURCE_FILES) -coverprofile $(COVERAGE) -timeout=30s -parallel=4 -cover -race
2323

24+
.PHONY: test-examples
25+
test-examples:
26+
cd examples && go test ./...
27+
2428
.PHONY: fmt
2529
fmt:
2630
@echo "==> Fixing source code with gofmt..."

examples/aws_cluster/aws.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func createDatabaseUserRequest(sdk *admin.APIClient, groupId string) *admin.Clou
114114
}
115115
}
116116

117-
func createClusterRequest(projectId string) *admin.AdvancedClusterDescription {
117+
func createClusterRequest(projectId string) *admin.ClusterDescription20240805 {
118118
// Input arguments used for creation of the cluster
119119
clusterName, _ := uniqueName("example-aws-cluster")
120120

@@ -124,23 +124,21 @@ func createClusterRequest(projectId string) *admin.AdvancedClusterDescription {
124124
regionName := "US_EAST_1"
125125

126126
// Size
127-
numShards := int(1)
128127
priority := int(7)
129128
nodeCount := int(3)
130129
instanceSize := "M10"
131130

132-
return &admin.AdvancedClusterDescription{
131+
return &admin.ClusterDescription20240805{
133132
Name: &clusterName,
134133
ClusterType: &clusterType,
135-
ReplicationSpecs: &[]admin.ReplicationSpec{
134+
ReplicationSpecs: &[]admin.ReplicationSpec20240805{
136135
{
137-
NumShards: &numShards,
138-
RegionConfigs: &[]admin.CloudRegionConfig{
136+
RegionConfigs: &[]admin.CloudRegionConfig20240805{
139137
{
140138
ProviderName: &providerName,
141139
Priority: &priority,
142140
RegionName: &regionName,
143-
ElectableSpecs: &admin.HardwareSpec{
141+
ElectableSpecs: &admin.HardwareSpec20240805{
144142
InstanceSize: &instanceSize,
145143
NodeCount: &nodeCount,
146144
},

examples/mock/cluster_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package test
1+
package examples
22

33
import (
44
"context"
@@ -25,9 +25,9 @@ func TestListClusters(t *testing.T) {
2525
clusterAPI := mockadmin.NewClustersApi(t)
2626

2727
// Program expectations.
28-
list := &admin.PaginatedAdvancedClusterDescription{
28+
list := &admin.PaginatedClusterDescription20240805{
2929
TotalCount: admin.PtrInt(2),
30-
Results: &[]admin.AdvancedClusterDescription{
30+
Results: &[]admin.ClusterDescription20240805{
3131
{StateName: admin.PtrString("IDLE")},
3232
{StateName: admin.PtrString("DELETING")},
3333
},

0 commit comments

Comments
 (0)