Skip to content

Commit cc52384

Browse files
Compliance with openapi specs and tests are passing
1 parent 4c156e4 commit cc52384

File tree

2 files changed

+26
-38
lines changed

2 files changed

+26
-38
lines changed

stack_deployment_groups.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,21 @@ const (
2121
DeploymentGroupStatusAbandoned DeploymentGroupStatus = "abandoned"
2222
)
2323

24-
var DeploymentGroupStatuses = []DeploymentGroupStatus{
25-
DeploymentGroupStatusPending,
26-
DeploymentGroupStatusDeploying,
27-
DeploymentGroupStatusSucceeded,
28-
DeploymentGroupStatusFailed,
29-
DeploymentGroupStatusAbandoned,
30-
}
31-
3224
type stackDeploymentGroups struct {
3325
client *Client
3426
}
3527

3628
var _ StackDeploymentGroups = &stackDeploymentGroups{}
3729

3830
type StackDeploymentGroup struct {
39-
Id string
40-
Name string
41-
Status DeploymentGroupStatus
42-
CreatedAt string
43-
UpdatedAt string // time.RFC3339
44-
StackConfigurationId string
45-
FailureCount int
31+
ID string
32+
Name string `jsonapi:"attr,name"`
33+
Status DeploymentGroupStatus `jsonapi:"attr,status"`
34+
CreatedAt string
35+
UpdatedAt string
36+
37+
// Relationships
38+
StackConfiguration StackConfiguration
4639
}
4740

4841
// StackDeploymentGroupList represents a list of stack deployment groups.

stack_deployment_groups_integration_test.go

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,39 +44,34 @@ func TestStackDeploymentGroupsList(t *testing.T) {
4444
stackUpdated.LatestStackConfiguration, _ = client.StackConfigurations.Read(ctx, stackUpdated.LatestStackConfiguration.ID)
4545

4646
t.Run("with valid stack configuration ID", func(t *testing.T) {
47-
//t.Parallel()
4847
sdgl, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, nil)
4948
require.NoError(t, err)
5049
require.NotNil(t, sdgl)
51-
5250
for _, item := range sdgl.Items {
53-
assert.NotNil(t, item.Id)
51+
assert.NotNil(t, item.ID)
5452
assert.NotEmpty(t, item.Name)
5553
assert.NotEmpty(t, item.Status)
5654
assert.NotNil(t, item.CreatedAt)
5755
assert.NotNil(t, item.UpdatedAt)
58-
assert.NotEmpty(t, item.StackConfigurationId)
59-
assert.GreaterOrEqual(t, item.FailureCount, 0)
6056
}
57+
require.Len(t, sdgl.Items, 2)
6158
})
6259

63-
// t.Run("with invalid stack configuration ID", func(t *testing.T) {
64-
// //t.Parallel()
65-
// _, err := client.StackDeploymentGroups.List(ctx, "", nil)
66-
// require.Error(t, err)
67-
// })
60+
t.Run("with invalid stack configuration ID", func(t *testing.T) {
61+
_, err := client.StackDeploymentGroups.List(ctx, "", nil)
62+
require.Error(t, err)
63+
})
6864

69-
// t.Run("List with pagination", func(t *testing.T) {
70-
// t.Parallel()
71-
// options := &StackDeploymentGroupListOptions{
72-
// ListOptions: ListOptions{
73-
// PageNumber: 2,
74-
// PageSize: 2,
75-
// },
76-
// }
77-
// sdgl, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, options)
78-
// require.NoError(t, err)
79-
// require.NotNil(t, sdgl)
80-
// require.Len(t, sdgl.Items, 0)
81-
// })
65+
t.Run("List with pagination", func(t *testing.T) {
66+
options := &StackDeploymentGroupListOptions{
67+
ListOptions: ListOptions{
68+
PageNumber: 1,
69+
PageSize: 1,
70+
},
71+
}
72+
sdgl, err := client.StackDeploymentGroups.List(ctx, stackUpdated.LatestStackConfiguration.ID, options)
73+
require.NoError(t, err)
74+
require.NotNil(t, sdgl)
75+
require.Len(t, sdgl.Items, 1)
76+
})
8277
}

0 commit comments

Comments
 (0)