Skip to content

Commit

Permalink
fix: Do not quietly exit, report errors!
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-qvest-seidl committed Aug 2, 2024
1 parent 60ea93e commit 144e1c4
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/meta"
"github.com/qvest-digital/terraform-provider-keycloak/keycloak"
"log"
"os"
"testing"
)
Expand Down Expand Up @@ -53,23 +54,17 @@ func TestMain(m *testing.M) {

err := keycloakClient.DeleteRealm(testCtx, testAccRealm.Realm)
if err != nil {
println("Unable to delete realm: " + testAccRealm.Realm)
println(err)
os.Exit(1)
log.Fatalf("Unable to delete realm %s: %s", testAccRealmUserFederation.Realm, err)
}

err = keycloakClient.DeleteRealm(testCtx, testAccRealmTwo.Realm)
if err != nil {
println("Unable to delete realm: " + testAccRealmTwo.Realm)
println(err)
os.Exit(1)
log.Fatalf("Unable to delete realm %s: %s", testAccRealmUserFederation.Realm, err)
}

err = keycloakClient.DeleteRealm(testCtx, testAccRealmUserFederation.Realm)
if err != nil {
println("Unable to delete realm: " + testAccRealmUserFederation.Realm)
println(err)
os.Exit(1)
log.Fatalf("Unable to delete realm %s: %s", testAccRealmUserFederation.Realm, err)
}

os.Exit(code)
Expand All @@ -85,9 +80,7 @@ func createTestRealm(testCtx context.Context) *keycloak.Realm {

err := keycloakClient.NewRealm(testCtx, r)
if err != nil {
println("Unable to create realm: " + r.Realm)
println(err)
os.Exit(1)
log.Fatalf("Unable to create new realm: %s", err)
}

return r
Expand Down

0 comments on commit 144e1c4

Please sign in to comment.