fix: tests
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 7s
CI Workflow / CI (pull_request) Failing after 27m26s
CI Workflow / Code coverage report (pull_request) Has been skipped
CI Workflow / Test readiness for publishing provider (pull_request) Successful in 34m1s

This commit is contained in:
Marcel_Henselin 2026-02-13 11:26:47 +01:00
parent 10af1dbbba
commit 57758e1efc
6 changed files with 172 additions and 39 deletions

View file

@ -91,7 +91,7 @@ func CreateInstanceWaitHandler(
}
switch strings.ToLower(string(*s.Status)) {
case strings.ToLower(InstanceStateSuccess):
if *s.Network.AccessScope == "SNA" {
if s.Network != nil && s.Network.AccessScope != nil && *s.Network.AccessScope == "SNA" {
if s.Network.InstanceAddress == nil {
tflog.Info(ctx, "Waiting for instance_address")
return false, nil, nil

View file

@ -20,6 +20,57 @@ type apiClientInstanceMocked struct {
instanceGetFails bool
}
type ListUsersRequestRequest struct{}
func (l ListUsersRequestRequest) Page(page int64) sqlserverflex.ApiListUsersRequestRequest {
return l
}
func (l ListUsersRequestRequest) Size(size int64) sqlserverflex.ApiListUsersRequestRequest {
return l
}
func (l ListUsersRequestRequest) Sort(sort sqlserverflex.UserSort) sqlserverflex.ApiListUsersRequestRequest {
return l
}
func (l ListUsersRequestRequest) Execute() (*sqlserverflex.ListUserResponse, error) {
//TODO implement me
panic("implement me")
}
func (a *apiClientInstanceMocked) ListUsersRequest(
ctx context.Context,
projectId string,
region string,
instanceId string,
) sqlserverflex.ApiListUsersRequestRequest {
return ListUsersRequestRequest{}
}
func (a *apiClientInstanceMocked) ListRolesRequestExecute(
ctx context.Context,
projectId string,
region string,
instanceId string,
) (*sqlserverflex.ListRolesResponse, error) {
return &sqlserverflex.ListRolesResponse{
Roles: &[]string{},
}, nil
}
func (a *apiClientInstanceMocked) ListUsersRequestExecute(
ctx context.Context,
projectId string,
region string,
instanceId string,
) (*sqlserverflex.ListUserResponse, error) {
return &sqlserverflex.ListUserResponse{
Pagination: nil,
Users: nil,
}, nil
}
func (a *apiClientInstanceMocked) GetDatabaseRequestExecute(
_ context.Context,
projectId string,
@ -63,7 +114,7 @@ func (a *apiClientInstanceMocked) GetInstanceRequestExecute(
}, nil
}
func TestCreateInstanceWaitHandler(t *testing.T) {
t.Skip("skipping - needs refactoring")
//t.Skip("skipping - needs refactoring")
tests := []struct {
desc string
instanceGetFails bool