feat: refactor testing
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 6s
CI Workflow / CI (pull_request) Failing after 10m15s
CI Workflow / Code coverage report (pull_request) Has been skipped
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 12m58s

This commit is contained in:
Marcel_Henselin 2026-02-09 08:24:41 +01:00
parent 32e41d8b44
commit 7b43d2fe52
6 changed files with 486 additions and 60 deletions

View file

@ -96,7 +96,7 @@ func UpdateInstanceWaitHandler(ctx context.Context, a APIClientInterface, projec
tflog.Info(ctx, "request is being handled", map[string]interface{}{
"status": *s.Status,
})
return false, nil, nil
return false, s, nil
default:
tflog.Info(ctx, "Wait (update) received unknown status", map[string]interface{}{
"instanceId": instanceId,
@ -105,17 +105,15 @@ func UpdateInstanceWaitHandler(ctx context.Context, a APIClientInterface, projec
return false, s, nil
}
})
handler.SetSleepBeforeWait(15 * time.Second)
handler.SetTimeout(45 * time.Minute)
return handler
}
// DeleteInstanceWaitHandler will wait for instance deletion
func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInterface, projectId, instanceId, region string) *wait.AsyncActionHandler[struct{}] {
handler := wait.New(func() (waitFinished bool, response *struct{}, err error) {
_, err = a.GetInstanceRequestExecute(ctx, projectId, region, instanceId)
func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInterface, projectId, instanceId, region string) *wait.AsyncActionHandler[sqlserverflex.GetInstanceResponse] {
handler := wait.New(func() (waitFinished bool, response *sqlserverflex.GetInstanceResponse, err error) {
s, err := a.GetInstanceRequestExecute(ctx, projectId, region, instanceId)
if err == nil {
return false, nil, nil
return false, s, nil
}
var oapiErr *oapierror.GenericOpenAPIError
ok := errors.As(err, &oapiErr)
@ -127,7 +125,7 @@ func DeleteInstanceWaitHandler(ctx context.Context, a APIClientInterface, projec
}
return true, nil, nil
})
handler.SetTimeout(15 * time.Minute)
handler.SetTimeout(30 * time.Minute)
return handler
}