From 07d9bb03ec0a2f0602e9a93712cb5d4bc74a4f88 Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Wed, 23 Jul 2014 20:53:02 -0400 Subject: [PATCH] providers/dnsimple: handle custom domains --- .../providers/dnsimple/resource_dnsimple_record_test.go | 8 +++++--- builtin/providers/dnsimple/resource_provider_test.go | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/builtin/providers/dnsimple/resource_dnsimple_record_test.go b/builtin/providers/dnsimple/resource_dnsimple_record_test.go index eb91e7f6d..70217d35e 100644 --- a/builtin/providers/dnsimple/resource_dnsimple_record_test.go +++ b/builtin/providers/dnsimple/resource_dnsimple_record_test.go @@ -2,6 +2,7 @@ package dnsimple import ( "fmt" + "os" "strconv" "testing" @@ -12,6 +13,7 @@ import ( func TestAccDNSimpleRecord_Basic(t *testing.T) { var record dnsimple.Record + domain := os.Getenv("DNSIMPLE_DOMAIN") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -19,14 +21,14 @@ func TestAccDNSimpleRecord_Basic(t *testing.T) { CheckDestroy: testAccCheckDNSimpleRecordDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckDNSimpleRecordConfig_basic, + Config: fmt.Sprintf(testAccCheckDNSimpleRecordConfig_basic, domain), Check: resource.ComposeTestCheckFunc( testAccCheckDNSimpleRecordExists("dnsimple_record.foobar", &record), testAccCheckDNSimpleRecordAttributes(&record), resource.TestCheckResourceAttr( "dnsimple_record.foobar", "name", "terraform"), resource.TestCheckResourceAttr( - "dnsimple_record.foobar", "domain", "jack.ly"), + "dnsimple_record.foobar", "domain", domain), resource.TestCheckResourceAttr( "dnsimple_record.foobar", "value", "192.168.0.10"), ), @@ -106,7 +108,7 @@ func testAccCheckDNSimpleRecordExists(n string, record *dnsimple.Record) resourc const testAccCheckDNSimpleRecordConfig_basic = ` resource "dnsimple_record" "foobar" { - domain = "jack.ly" + domain = "%s" name = "terraform" value = "192.168.0.10" diff --git a/builtin/providers/dnsimple/resource_provider_test.go b/builtin/providers/dnsimple/resource_provider_test.go index 63dd0b067..5f0bd5f25 100644 --- a/builtin/providers/dnsimple/resource_provider_test.go +++ b/builtin/providers/dnsimple/resource_provider_test.go @@ -73,4 +73,8 @@ func testAccPreCheck(t *testing.T) { if v := os.Getenv("DNSIMPLE_TOKEN"); v == "" { t.Fatal("DNSIMPLE_TOKEN must be set for acceptance tests") } + + if v := os.Getenv("DNSIMPLE_DOMAIN"); v == "" { + t.Fatal("DNSIMPLE_DOMAIN must be set for acceptance tests. The domain is used to create and destroy record against.") + } }