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

This commit is contained in:
Marcel S. Henselin 2026-03-09 10:26:18 +01:00
parent ca0f646526
commit 826bb5b36a
36 changed files with 2089 additions and 1166 deletions

View file

@ -5,9 +5,7 @@ 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/sqlserverflexalpha"
sqlserverflexalpha "github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex/v3alpha1api"
datasource "tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/stackit/internal/services/sqlserverflexalpha/database/datasources_gen"
)
@ -31,11 +29,11 @@ func TestMapFields(t *testing.T) {
name: "should map fields correctly",
given: given{
source: &sqlserverflexalpha.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"),
Id: (int64(1)),
Name: ("my-db"),
CollationName: ("collation"),
CompatibilityLevel: (int32(150)),
Owner: ("my-owner"),
},
model: &dataSourceModel{
DatabaseModel: datasource.DatabaseModel{
@ -73,7 +71,7 @@ func TestMapFields(t *testing.T) {
{
name: "should fail on nil source ID",
given: given{
source: &sqlserverflexalpha.GetDatabaseResponse{Id: nil},
source: &sqlserverflexalpha.GetDatabaseResponse{Id: 0},
model: &dataSourceModel{},
},
expected: expected{err: true},
@ -81,7 +79,7 @@ func TestMapFields(t *testing.T) {
{
name: "should fail on nil model",
given: given{
source: &sqlserverflexalpha.GetDatabaseResponse{Id: utils.Ptr(int64(1))},
source: &sqlserverflexalpha.GetDatabaseResponse{Id: (int64(1))},
model: nil,
},
expected: expected{err: true},
@ -125,9 +123,9 @@ func TestMapResourceFields(t *testing.T) {
name: "should map fields correctly",
given: given{
source: &sqlserverflexalpha.GetDatabaseResponse{
Id: utils.Ptr(int64(1)),
Name: utils.Ptr("my-db"),
Owner: utils.Ptr("my-owner"),
Id: (int64(1)),
Name: ("my-db"),
Owner: ("my-owner"),
},
model: &resourceModel{
ProjectId: types.StringValue("my-project"),
@ -202,8 +200,8 @@ func TestToCreatePayload(t *testing.T) {
},
expected: expected{
payload: &sqlserverflexalpha.CreateDatabaseRequestPayload{
Name: utils.Ptr("my-db"),
Owner: utils.Ptr("my-owner"),
Name: ("my-db"),
Owner: ("my-owner"),
},
},
},