fix: tests (#57)
## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #57
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
parent
10af1dbbba
commit
843fc46f54
6 changed files with 172 additions and 39 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue