@@ -21,17 +21,13 @@ type apiClientInstanceMocked struct {
2121 resourceDescription string
2222}
2323
24- const (
25- instanceTypeDelete = "delete"
26- )
27-
2824func (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 }
0 commit comments