fix: adjust to new generator and sdk use
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 5s
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 3m33s
CI Workflow / CI run tests (pull_request) Failing after 4m51s
CI Workflow / CI run build and linting (pull_request) Failing after 4m37s
CI Workflow / Code coverage report (pull_request) Has been skipped
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 5s
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 3m33s
CI Workflow / CI run tests (pull_request) Failing after 4m51s
CI Workflow / CI run build and linting (pull_request) Failing after 4m37s
CI Workflow / Code coverage report (pull_request) Has been skipped
This commit is contained in:
parent
ca0f646526
commit
826bb5b36a
36 changed files with 2089 additions and 1166 deletions
|
|
@ -6,14 +6,13 @@ import (
|
|||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"github.com/stackitcloud/stackit-sdk-go/core/utils"
|
||||
|
||||
"tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/pkg_gen/sqlserverflexbeta"
|
||||
"github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v3beta1api"
|
||||
datasource "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexbeta/database/datasources_gen"
|
||||
)
|
||||
|
||||
func TestMapFields(t *testing.T) {
|
||||
type given struct {
|
||||
source *sqlserverflexbeta.GetDatabaseResponse
|
||||
source *v3beta1api.GetDatabaseResponse
|
||||
model *dataSourceModel
|
||||
region string
|
||||
}
|
||||
|
|
@ -30,12 +29,12 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
name: "should map fields correctly",
|
||||
given: given{
|
||||
source: &sqlserverflexbeta.GetDatabaseResponse{
|
||||
Id: utils.Ptr(int64(1)),
|
||||
Name: utils.Ptr("my-db"),
|
||||
CollationName: utils.Ptr("collation"),
|
||||
CompatibilityLevel: utils.Ptr(int64(150)),
|
||||
Owner: utils.Ptr("my-owner"),
|
||||
source: &v3beta1api.GetDatabaseResponse{
|
||||
Id: int64(1),
|
||||
Name: "my-db",
|
||||
CollationName: "collation",
|
||||
CompatibilityLevel: int32(150),
|
||||
Owner: "my-owner",
|
||||
},
|
||||
model: &dataSourceModel{
|
||||
DatabaseModel: datasource.DatabaseModel{
|
||||
|
|
@ -73,7 +72,7 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
name: "should fail on nil source ID",
|
||||
given: given{
|
||||
source: &sqlserverflexbeta.GetDatabaseResponse{Id: nil},
|
||||
source: &v3beta1api.GetDatabaseResponse{Id: 0},
|
||||
model: &dataSourceModel{},
|
||||
},
|
||||
expected: expected{err: true},
|
||||
|
|
@ -81,7 +80,7 @@ func TestMapFields(t *testing.T) {
|
|||
{
|
||||
name: "should fail on nil model",
|
||||
given: given{
|
||||
source: &sqlserverflexbeta.GetDatabaseResponse{Id: utils.Ptr(int64(1))},
|
||||
source: &v3beta1api.GetDatabaseResponse{Id: int64(1)},
|
||||
model: nil,
|
||||
},
|
||||
expected: expected{err: true},
|
||||
|
|
@ -107,7 +106,7 @@ func TestMapFields(t *testing.T) {
|
|||
|
||||
func TestMapResourceFields(t *testing.T) {
|
||||
type given struct {
|
||||
source *sqlserverflexbeta.GetDatabaseResponse
|
||||
source *v3beta1api.GetDatabaseResponse
|
||||
model *resourceModel
|
||||
region string
|
||||
}
|
||||
|
|
@ -124,10 +123,10 @@ func TestMapResourceFields(t *testing.T) {
|
|||
{
|
||||
name: "should map fields correctly",
|
||||
given: given{
|
||||
source: &sqlserverflexbeta.GetDatabaseResponse{
|
||||
Id: utils.Ptr(int64(1)),
|
||||
Name: utils.Ptr("my-db"),
|
||||
Owner: utils.Ptr("my-owner"),
|
||||
source: &v3beta1api.GetDatabaseResponse{
|
||||
Id: (int64(1)),
|
||||
Name: ("my-db"),
|
||||
Owner: ("my-owner"),
|
||||
},
|
||||
model: &resourceModel{
|
||||
ProjectId: types.StringValue("my-project"),
|
||||
|
|
@ -183,7 +182,7 @@ func TestToCreatePayload(t *testing.T) {
|
|||
model *resourceModel
|
||||
}
|
||||
type expected struct {
|
||||
payload *sqlserverflexbeta.CreateDatabaseRequestPayload
|
||||
payload *v3beta1api.CreateDatabaseRequestPayload
|
||||
err bool
|
||||
}
|
||||
|
||||
|
|
@ -201,9 +200,10 @@ func TestToCreatePayload(t *testing.T) {
|
|||
},
|
||||
},
|
||||
expected: expected{
|
||||
payload: &sqlserverflexbeta.CreateDatabaseRequestPayload{
|
||||
Name: utils.Ptr("my-db"),
|
||||
Owner: utils.Ptr("my-owner"),
|
||||
payload: &v3beta1api.CreateDatabaseRequestPayload{
|
||||
Name: "my-db",
|
||||
Owner: "my-owner",
|
||||
Compatibility: utils.Ptr(int32(0)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue