Skip to content

Commit 7e039ab

Browse files
committed
add removed exported consts
1 parent 8069a7b commit 7e039ab

File tree

8 files changed

+52
-48
lines changed

8 files changed

+52
-48
lines changed

services/logme/wait/wait.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const (
1717
InstanceStatusFailed = "failed"
1818
InstanceStatusDeleting = "deleting"
1919
InstanceStateSuccess = "succeeded"
20+
InstanceTypeCreate = "create"
21+
InstanceTypeUpdate = "update"
22+
InstanceTypeDelete = "delete"
2023
)
2124

2225
// Interface needed for tests

services/logme/wait/wait_test.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ type apiClientInstanceMocked struct {
2121
resourceDescription string
2222
}
2323

24-
const (
25-
instanceTypeDelete = "delete"
26-
)
27-
2824
func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ string) (*logme.Instance, error) {
2925
if a.getFails {
3026
return nil, &oapierror.GenericOpenAPIError{
3127
StatusCode: 500,
3228
}
3329
}
34-
if a.resourceOperation != nil && *a.resourceOperation == instanceTypeDelete && a.resourceState == InstanceStateSuccess {
30+
if a.resourceOperation != nil && *a.resourceOperation == InstanceTypeDelete && a.resourceState == InstanceStateSuccess {
3531
if a.deletionSucceedsWithErrors {
3632
return &logme.Instance{
3733
InstanceId: &a.resourceId,
@@ -121,9 +117,10 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
121117
instanceId := "foo-bar"
122118

123119
apiClient := &apiClientInstanceMocked{
124-
getFails: tt.getFails,
125-
resourceId: instanceId,
126-
resourceState: tt.resourceState,
120+
getFails: tt.getFails,
121+
resourceId: instanceId,
122+
resourceOperation: utils.Ptr(InstanceTypeCreate),
123+
resourceState: tt.resourceState,
127124
}
128125

129126
var wantRes *logme.Instance
@@ -190,9 +187,10 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
190187
instanceId := "foo-bar"
191188

192189
apiClient := &apiClientInstanceMocked{
193-
getFails: tt.getFails,
194-
resourceId: instanceId,
195-
resourceState: tt.resourceState,
190+
getFails: tt.getFails,
191+
resourceId: instanceId,
192+
resourceOperation: utils.Ptr(InstanceTypeUpdate),
193+
resourceState: tt.resourceState,
196194
}
197195

198196
var wantRes *logme.Instance
@@ -268,7 +266,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) {
268266
getFails: tt.getFails,
269267
deletionSucceedsWithErrors: tt.deleteSucceeedsWithErrors,
270268
resourceId: instanceId,
271-
resourceOperation: utils.Ptr(instanceTypeDelete),
269+
resourceOperation: utils.Ptr(InstanceTypeDelete),
272270
resourceDescription: tt.resourceDescription,
273271
resourceState: tt.resourceState,
274272
}

services/mariadb/wait/wait.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const (
1717
InstanceStatusFailed = "failed"
1818
InstanceStatusDeleting = "deleting"
1919
InstanceStateSuccess = "succeeded"
20+
InstanceTypeCreate = "create"
21+
InstanceTypeUpdate = "update"
22+
InstanceTypeDelete = "delete"
2023
)
2124

2225
// Interface needed for tests

services/mariadb/wait/wait_test.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ type apiClientInstanceMocked struct {
2121
resourceDescription string
2222
}
2323

24-
const (
25-
instanceTypeDelete = "delete"
26-
)
27-
2824
func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ string) (*mariadb.Instance, error) {
2925
if a.getFails {
3026
return nil, &oapierror.GenericOpenAPIError{
3127
StatusCode: 500,
3228
}
3329
}
34-
if a.resourceOperation != nil && *a.resourceOperation == instanceTypeDelete && a.resourceState == InstanceStateSuccess {
30+
if a.resourceOperation != nil && *a.resourceOperation == InstanceTypeDelete && a.resourceState == InstanceStateSuccess {
3531
if a.deletionSucceedsWithErrors {
3632
return &mariadb.Instance{
3733
InstanceId: &a.resourceId,
@@ -121,9 +117,10 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
121117
instanceId := "foo-bar"
122118

123119
apiClient := &apiClientInstanceMocked{
124-
getFails: tt.getFails,
125-
resourceId: instanceId,
126-
resourceState: tt.resourceState,
120+
getFails: tt.getFails,
121+
resourceId: instanceId,
122+
resourceOperation: utils.Ptr(InstanceTypeCreate),
123+
resourceState: tt.resourceState,
127124
}
128125

129126
var wantRes *mariadb.Instance
@@ -190,9 +187,10 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
190187
instanceId := "foo-bar"
191188

192189
apiClient := &apiClientInstanceMocked{
193-
getFails: tt.getFails,
194-
resourceId: instanceId,
195-
resourceState: tt.resourceState,
190+
getFails: tt.getFails,
191+
resourceId: instanceId,
192+
resourceOperation: utils.Ptr(InstanceTypeUpdate),
193+
resourceState: tt.resourceState,
196194
}
197195

198196
var wantRes *mariadb.Instance
@@ -263,7 +261,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) {
263261
getFails: tt.getFails,
264262
deletionSucceedsWithErrors: tt.deleteSucceeedsWithErrors,
265263
resourceId: instanceId,
266-
resourceOperation: utils.Ptr(instanceTypeDelete),
264+
resourceOperation: utils.Ptr(InstanceTypeDelete),
267265
resourceDescription: tt.resourceDescription,
268266
resourceState: tt.resourceState,
269267
}

services/opensearch/wait/wait.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const (
1717
InstanceStatusFailed = "failed"
1818
InstanceStatusDeleting = "deleting"
1919
InstanceStateSuccess = "succeeded"
20+
InstanceTypeCreate = "create"
21+
InstanceTypeUpdate = "update"
22+
InstanceTypeDelete = "delete"
2023
)
2124

2225
// Interface needed for tests

services/opensearch/wait/wait_test.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ type apiClientInstanceMocked struct {
2121
resourceDescription string
2222
}
2323

24-
const (
25-
instanceTypeDelete = "delete"
26-
)
27-
2824
func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ string) (*opensearch.Instance, error) {
2925
if a.getFails {
3026
return nil, &oapierror.GenericOpenAPIError{
3127
StatusCode: 500,
3228
}
3329
}
34-
if a.resourceOperation != nil && *a.resourceOperation == instanceTypeDelete && a.resourceState == InstanceStateSuccess {
30+
if a.resourceOperation != nil && *a.resourceOperation == InstanceTypeDelete && a.resourceState == InstanceStateSuccess {
3531
if a.deletionSucceedsWithErrors {
3632
return &opensearch.Instance{
3733
InstanceId: &a.resourceId,
@@ -121,9 +117,10 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
121117
instanceId := "foo-bar"
122118

123119
apiClient := &apiClientInstanceMocked{
124-
getFails: tt.getFails,
125-
resourceId: instanceId,
126-
resourceState: tt.resourceState,
120+
getFails: tt.getFails,
121+
resourceId: instanceId,
122+
resourceOperation: utils.Ptr(InstanceTypeCreate),
123+
resourceState: tt.resourceState,
127124
}
128125

129126
var wantRes *opensearch.Instance
@@ -190,9 +187,10 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
190187
instanceId := "foo-bar"
191188

192189
apiClient := &apiClientInstanceMocked{
193-
getFails: tt.getFails,
194-
resourceId: instanceId,
195-
resourceState: tt.resourceState,
190+
getFails: tt.getFails,
191+
resourceId: instanceId,
192+
resourceOperation: utils.Ptr(InstanceTypeUpdate),
193+
resourceState: tt.resourceState,
196194
}
197195

198196
var wantRes *opensearch.Instance
@@ -263,7 +261,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) {
263261
getFails: tt.getFails,
264262
deletionSucceedsWithErrors: tt.deleteSucceeedsWithErrors,
265263
resourceId: instanceId,
266-
resourceOperation: utils.Ptr(instanceTypeDelete),
264+
resourceOperation: utils.Ptr(InstanceTypeDelete),
267265
resourceDescription: tt.resourceDescription,
268266
resourceState: tt.resourceState,
269267
}

services/redis/wait/wait.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const (
1717
InstanceStatusFailed = "failed"
1818
InstanceStatusDeleting = "deleting"
1919
InstanceStateSuccess = "succeeded"
20+
InstanceTypeCreate = "create"
21+
InstanceTypeUpdate = "update"
22+
InstanceTypeDelete = "delete"
2023
)
2124

2225
// Interface needed for tests

services/redis/wait/wait_test.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ type apiClientInstanceMocked struct {
2121
resourceDescription string
2222
}
2323

24-
const (
25-
instanceTypeDelete = "delete"
26-
)
27-
2824
func (a *apiClientInstanceMocked) GetInstanceExecute(_ context.Context, _, _ string) (*redis.Instance, error) {
2925
if a.getFails {
3026
return nil, &oapierror.GenericOpenAPIError{
3127
StatusCode: 500,
3228
}
3329
}
34-
if a.resourceOperation != nil && *a.resourceOperation == instanceTypeDelete && a.resourceState == InstanceStateSuccess {
30+
if a.resourceOperation != nil && *a.resourceOperation == InstanceTypeDelete && a.resourceState == InstanceStateSuccess {
3531
if a.deletionSucceedsWithErrors {
3632
return &redis.Instance{
3733
InstanceId: &a.resourceId,
@@ -121,9 +117,10 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
121117
instanceId := "foo-bar"
122118

123119
apiClient := &apiClientInstanceMocked{
124-
getFails: tt.getFails,
125-
resourceId: instanceId,
126-
resourceState: tt.resourceState,
120+
getFails: tt.getFails,
121+
resourceId: instanceId,
122+
resourceOperation: utils.Ptr(InstanceTypeCreate),
123+
resourceState: tt.resourceState,
127124
}
128125

129126
var wantRes *redis.Instance
@@ -190,9 +187,10 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
190187
instanceId := "foo-bar"
191188

192189
apiClient := &apiClientInstanceMocked{
193-
getFails: tt.getFails,
194-
resourceId: instanceId,
195-
resourceState: tt.resourceState,
190+
getFails: tt.getFails,
191+
resourceId: instanceId,
192+
resourceOperation: utils.Ptr(InstanceTypeUpdate),
193+
resourceState: tt.resourceState,
196194
}
197195

198196
var wantRes *redis.Instance
@@ -263,7 +261,7 @@ func TestDeleteInstanceWaitHandler(t *testing.T) {
263261
getFails: tt.getFails,
264262
deletionSucceedsWithErrors: tt.deleteSucceeedsWithErrors,
265263
resourceId: instanceId,
266-
resourceOperation: utils.Ptr(instanceTypeDelete),
264+
resourceOperation: utils.Ptr(InstanceTypeDelete),
267265
resourceDescription: tt.resourceDescription,
268266
resourceState: tt.resourceState,
269267
}

0 commit comments

Comments
 (0)