fix: fix linter errors
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 17s
CI Workflow / Prepare GO cache (pull_request) Successful in 2m10s
CI Workflow / CI run build and linting (pull_request) Successful in 7m10s
CI Workflow / Code coverage report (pull_request) Successful in 4s
CI Workflow / CI run tests (pull_request) Failing after 9m13s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 16m53s
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 17s
CI Workflow / Prepare GO cache (pull_request) Successful in 2m10s
CI Workflow / CI run build and linting (pull_request) Successful in 7m10s
CI Workflow / Code coverage report (pull_request) Successful in 4s
CI Workflow / CI run tests (pull_request) Failing after 9m13s
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 16m53s
This commit is contained in:
parent
ab9ff41b24
commit
c8ea125bac
45 changed files with 1266 additions and 139 deletions
|
|
@ -199,7 +199,7 @@ func PartialUpdateInstanceWaitHandler(
|
|||
}
|
||||
},
|
||||
)
|
||||
// handler.SetTimeout(45 * time.Minute).SetSleepBeforeWait(30 * time.Second)
|
||||
handler.SetTimeout(45 * time.Minute).SetSleepBeforeWait(30 * time.Second)
|
||||
return handler
|
||||
}
|
||||
|
||||
|
|
@ -207,16 +207,16 @@ func PartialUpdateInstanceWaitHandler(
|
|||
func GetUserByIdWaitHandler(
|
||||
ctx context.Context,
|
||||
a APIClientUserInterface,
|
||||
projectId, instanceId, region string,
|
||||
userId int64,
|
||||
projectID, instanceID, region string,
|
||||
userID int64,
|
||||
) *wait.AsyncActionHandler[v3alpha1api.GetUserResponse] {
|
||||
handler := wait.New(
|
||||
func() (waitFinished bool, response *v3alpha1api.GetUserResponse, err error) {
|
||||
if userId > math.MaxInt32 {
|
||||
if userID > math.MaxInt32 {
|
||||
return false, nil, fmt.Errorf("userID too large for int32")
|
||||
}
|
||||
userId32 := int32(userId)
|
||||
s, err := a.GetUserRequest(ctx, projectId, region, instanceId, userId32).Execute()
|
||||
userID32 := int32(userID) //nolint:gosec // checked above
|
||||
s, err := a.GetUserRequest(ctx, projectID, region, instanceID, userID32).Execute()
|
||||
if err != nil {
|
||||
var oapiErr *oapierror.GenericOpenAPIError
|
||||
ok := errors.As(err, &oapiErr)
|
||||
|
|
@ -246,16 +246,16 @@ func GetUserByIdWaitHandler(
|
|||
func GetDatabaseByIdWaitHandler(
|
||||
ctx context.Context,
|
||||
a APIClientDatabaseInterface,
|
||||
projectId, instanceId, region string,
|
||||
databaseId int64,
|
||||
projectID, instanceID, region string,
|
||||
databaseID int64,
|
||||
) *wait.AsyncActionHandler[v3alpha1api.GetDatabaseResponse] {
|
||||
handler := wait.New(
|
||||
func() (waitFinished bool, response *v3alpha1api.GetDatabaseResponse, err error) {
|
||||
if databaseId > math.MaxInt32 {
|
||||
if databaseID > math.MaxInt32 {
|
||||
return false, nil, fmt.Errorf("databaseID too large for int32")
|
||||
}
|
||||
dbId32 := int32(databaseId)
|
||||
s, err := a.GetDatabaseRequest(ctx, projectId, region, instanceId, dbId32).Execute()
|
||||
dbId32 := int32(databaseID) //nolint:gosec // is checked above
|
||||
s, err := a.GetDatabaseRequest(ctx, projectID, region, instanceID, dbId32).Execute()
|
||||
if err != nil {
|
||||
var oapiErr *oapierror.GenericOpenAPIError
|
||||
ok := errors.As(err, &oapiErr)
|
||||
|
|
|
|||
|
|
@ -13,14 +13,6 @@ import (
|
|||
)
|
||||
|
||||
// Used for testing instance operations
|
||||
type apiClientInstanceMocked struct {
|
||||
instanceID string
|
||||
instanceState string
|
||||
instanceNetwork v3alpha1api.InstanceNetwork
|
||||
instanceIsDeleted bool
|
||||
instanceGetFails bool
|
||||
}
|
||||
|
||||
func TestCreateInstanceWaitHandler(t *testing.T) {
|
||||
instanceID := utils.Ptr("foo")
|
||||
tests := []struct {
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(
|
||||
tt.desc, func(t *testing.T) {
|
||||
|
||||
listRolesMock := func(_ v3beta1api.ApiListRolesRequestRequest) (*v3beta1api.ListRolesResponse, error) {
|
||||
return &v3beta1api.ListRolesResponse{
|
||||
Roles: []string{},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue