diff --git a/stackit/internal/services/postgresflexalpha/instance/functions_test.go b/stackit/internal/services/postgresflexalpha/instance/functions_test.go index 2d22006f..406e577f 100644 --- a/stackit/internal/services/postgresflexalpha/instance/functions_test.go +++ b/stackit/internal/services/postgresflexalpha/instance/functions_test.go @@ -115,6 +115,7 @@ func Test_handleEncryption(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { handleEncryption(tt.args.m, tt.args.resp) + t.Logf("need to implement more") }) } } diff --git a/stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go b/stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go index 84e76997..bd63defd 100644 --- a/stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go +++ b/stackit/internal/services/postgresflexalpha/postgresflex_acc_test.go @@ -994,6 +994,8 @@ func TestAccInstanceWithDatabases(t *testing.T) { //} func testAccCheckPostgresFlexDestroy(s *terraform.State) error { + testutils.Setup() + ctx := context.Background() var client *postgresflexalphaPkgGen.APIClient var err error diff --git a/stackit/internal/services/sqlserverflexbeta/instance/functions_test.go b/stackit/internal/services/sqlserverflexbeta/instance/functions_test.go index 0c6f6147..e9728b80 100644 --- a/stackit/internal/services/sqlserverflexbeta/instance/functions_test.go +++ b/stackit/internal/services/sqlserverflexbeta/instance/functions_test.go @@ -80,20 +80,30 @@ func Test_handleEncryption(t *testing.T) { }, }, }, - want: sqlserverflexbetaRs.EncryptionValue{ - KekKeyId: types.StringValue("kek_key_id"), - KekKeyRingId: types.StringValue("kek_key_ring_id"), - KekKeyVersion: types.StringValue("kek_key_version"), - ServiceAccount: types.StringValue("kek_svc_acc"), - }, + want: sqlserverflexbetaRs.NewEncryptionValueMust( + sqlserverflexbetaRs.EncryptionValue{}.AttributeTypes(context.TODO()), + map[string]attr.Value{ + "kek_key_id": types.StringValue("kek_key_id"), + "kek_key_ring_id": types.StringValue("kek_key_ring_id"), + "kek_key_version": types.StringValue("kek_key_version"), + "service_account": types.StringValue("kek_svc_acc"), + }, + ), }, } for _, tt := range tests { t.Run( tt.name, func(t *testing.T) { - if got := handleEncryption(t.Context(), tt.args.m, tt.args.resp); !reflect.DeepEqual(got, tt.want) { - t.Errorf("handleEncryption() = %v, want %v", got, tt.want) + got := handleEncryption(t.Context(), tt.args.m, tt.args.resp) + + diff := cmp.Diff(tt.want, got) + if diff != "" { + t.Fatalf("Data does not match: %s", diff) } + + //if !reflect.DeepEqual(got, tt.want) { + // t.Errorf("handleEncryption() = %v, want %v", got, tt.want) + //} }, ) } diff --git a/stackit/internal/utils/strings.go b/stackit/internal/utils/strings.go index 21703484..745139f8 100644 --- a/stackit/internal/utils/strings.go +++ b/stackit/internal/utils/strings.go @@ -2,10 +2,10 @@ package utils func RemoveQuotes(src string) string { var res string - if len(src) > 0 && src[0] == '"' { + if src != "" && src[0] == '"' { res = src[1:] } - if len(res) > 0 && res[len(res)-1] == '"' { + if res != "" && res[len(res)-1] == '"' { res = res[:len(res)-1] } return res