fix: fix linting errors and test
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 10s
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 30s
CI Workflow / CI run build and linting (pull_request) Failing after 10s
CI Workflow / Code coverage report (pull_request) Has been skipped
CI Workflow / CI run tests (pull_request) Failing after 10m19s

This commit is contained in:
Marcel_Henselin 2026-03-02 09:14:13 +01:00
parent a63ae1831d
commit c15f21a16d
4 changed files with 23 additions and 10 deletions

View file

@ -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")
})
}
}

View file

@ -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

View file

@ -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)
//}
},
)
}

View file

@ -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