diff options
author | Mat Schaffer <mat@schaffer.me> | 2018-02-01 16:07:31 +0900 |
---|---|---|
committer | Mat Schaffer <mat@schaffer.me> | 2018-02-01 16:07:31 +0900 |
commit | aa4f9726b4fd3cc624fe5784b033840a6c92c84c (patch) | |
tree | e426709f68b0cae06577856f4e6e03226d1acc94 /statuscake/provider_test.go | |
parent | c9458806c73b69e6af47eddd83391197b6d2a641 (diff) | |
download | terraform-provider-statuscake-aa4f9726b4fd3cc624fe5784b033840a6c92c84c.tar.gz terraform-provider-statuscake-aa4f9726b4fd3cc624fe5784b033840a6c92c84c.tar.zst terraform-provider-statuscake-aa4f9726b4fd3cc624fe5784b033840a6c92c84c.zip |
Parameterize the contact ID used for acceptance testing
This allowed me to run acceptance tests on my own account.
Diffstat (limited to 'statuscake/provider_test.go')
-rw-r--r-- | statuscake/provider_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
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 @@ | |||
1 | package statuscake | 1 | package statuscake |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | ||
4 | "os" | 5 | "os" |
6 | "strconv" | ||
5 | "testing" | 7 | "testing" |
6 | 8 | ||
7 | "github.com/hashicorp/terraform/helper/schema" | 9 | "github.com/hashicorp/terraform/helper/schema" |
@@ -10,12 +12,25 @@ import ( | |||
10 | 12 | ||
11 | var testAccProviders map[string]terraform.ResourceProvider | 13 | var testAccProviders map[string]terraform.ResourceProvider |
12 | var testAccProvider *schema.Provider | 14 | var testAccProvider *schema.Provider |
15 | var testContactGroupId int | ||
13 | 16 | ||
14 | func init() { | 17 | func init() { |
15 | testAccProvider = Provider().(*schema.Provider) | 18 | testAccProvider = Provider().(*schema.Provider) |
16 | testAccProviders = map[string]terraform.ResourceProvider{ | 19 | testAccProviders = map[string]terraform.ResourceProvider{ |
17 | "statuscake": testAccProvider, | 20 | "statuscake": testAccProvider, |
18 | } | 21 | } |
22 | |||
23 | if v := os.Getenv("STATUSCAKE_TEST_CONTACT_GROUP_ID"); v == "" { | ||
24 | fmt.Println("STATUSCAKE_TEST_CONTACT_GROUP_ID must be set for acceptance tests") | ||
25 | os.Exit(1) | ||
26 | } else { | ||
27 | id, err := strconv.Atoi(v) | ||
28 | if err != nil { | ||
29 | fmt.Println("STATUSCAKE_TEST_CONTACT_GROUP_ID must be a valid int") | ||
30 | os.Exit(1) | ||
31 | } | ||
32 | testContactGroupId = id | ||
33 | } | ||
19 | } | 34 | } |
20 | 35 | ||
21 | func TestProvider(t *testing.T) { | 36 | func TestProvider(t *testing.T) { |