From aa4f9726b4fd3cc624fe5784b033840a6c92c84c Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Thu, 1 Feb 2018 16:07:31 +0900 Subject: Parameterize the contact ID used for acceptance testing This allowed me to run acceptance tests on my own account. --- statuscake/provider_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'statuscake/provider_test.go') diff --git a/statuscake/provider_test.go b/statuscake/provider_test.go index 83045d0..81d5888 100644 --- a/statuscake/provider_test.go +++ b/statuscake/provider_test.go @@ -1,7 +1,9 @@ package statuscake import ( + "fmt" "os" + "strconv" "testing" "github.com/hashicorp/terraform/helper/schema" @@ -10,12 +12,25 @@ import ( var testAccProviders map[string]terraform.ResourceProvider var testAccProvider *schema.Provider +var testContactGroupId int func init() { testAccProvider = Provider().(*schema.Provider) testAccProviders = map[string]terraform.ResourceProvider{ "statuscake": testAccProvider, } + + if v := os.Getenv("STATUSCAKE_TEST_CONTACT_GROUP_ID"); v == "" { + fmt.Println("STATUSCAKE_TEST_CONTACT_GROUP_ID must be set for acceptance tests") + os.Exit(1) + } else { + id, err := strconv.Atoi(v) + if err != nil { + fmt.Println("STATUSCAKE_TEST_CONTACT_GROUP_ID must be a valid int") + os.Exit(1) + } + testContactGroupId = id + } } func TestProvider(t *testing.T) { -- cgit v1.2.3