Skip to content

Commit

Permalink
Removing exit in favor of doing a cleaner PreCheck check and logging …
Browse files Browse the repository at this point in the history
…to fatal.
  • Loading branch information
Erix authored and Michael Cook committed Jan 19, 2017
1 parent 93868b6 commit 3d730e1
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions builtin/providers/aws/resource_aws_sns_application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package aws
import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"log"
"os"
"testing"

Expand All @@ -20,14 +19,13 @@ import (
**/

func TestAccAWSSNSApplication_gcm_create_update(t *testing.T) {

if os.Getenv("GCM_API_KEY") == "" {
log.Printf("Environment variable GCM_API_KEY not set. Tests cannot run.")
os.Exit(1)
}

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() {
testAccPreCheck(t)
if os.Getenv("GCM_API_KEY") == "" {
t.Fatal("GCM_API_KEY must be set.")
}
},
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSSNSApplicationDestroy,
Steps: []resource.TestStep{
Expand Down Expand Up @@ -75,18 +73,16 @@ func TestAccAWSSNSApplication_gcm_create_update(t *testing.T) {

func TestAccAWSSNSApplication_apns_sandbox_create_update(t *testing.T) {

if os.Getenv("APNS_SANDBOX_CREDENTIAL") == "" {
log.Printf("Environment variable APNS_SANDBOX_CREDENTIAL not set. Tests cannot run.")
os.Exit(1)
}

if os.Getenv("APNS_SANDBOX_PRINCIPAL") == "" {
log.Printf("Environment variable APNS_SANDBOX_CREDENTIAL not set. Tests cannot run.")
os.Exit(1)
}

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
PreCheck: func() {
testAccPreCheck(t)
if os.Getenv("APNS_SANDBOX_CREDENTIAL") == "" {
t.Fatal("APNS_SANDBOX_CREDENTIAL must be set.")
}
if os.Getenv("APNS_SANDBOX_PRINCIPAL") == "" {
t.Fatal("APNS_SANDBOX_PRINCIPAL must be set.")
}
},
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSSNSApplicationDestroy,
Steps: []resource.TestStep{
Expand Down

0 comments on commit 3d730e1

Please sign in to comment.