Merge branch 'master' of github.com:hashicorp/terraform
This commit is contained in:
commit
21d9417e2e
|
@ -2,6 +2,7 @@ package dnsimple
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ import (
|
||||||
|
|
||||||
func TestAccDNSimpleRecord_Basic(t *testing.T) {
|
func TestAccDNSimpleRecord_Basic(t *testing.T) {
|
||||||
var record dnsimple.Record
|
var record dnsimple.Record
|
||||||
|
domain := os.Getenv("DNSIMPLE_DOMAIN")
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
@ -19,14 +21,14 @@ func TestAccDNSimpleRecord_Basic(t *testing.T) {
|
||||||
CheckDestroy: testAccCheckDNSimpleRecordDestroy,
|
CheckDestroy: testAccCheckDNSimpleRecordDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: testAccCheckDNSimpleRecordConfig_basic,
|
Config: fmt.Sprintf(testAccCheckDNSimpleRecordConfig_basic, domain),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckDNSimpleRecordExists("dnsimple_record.foobar", &record),
|
testAccCheckDNSimpleRecordExists("dnsimple_record.foobar", &record),
|
||||||
testAccCheckDNSimpleRecordAttributes(&record),
|
testAccCheckDNSimpleRecordAttributes(&record),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"dnsimple_record.foobar", "name", "terraform"),
|
"dnsimple_record.foobar", "name", "terraform"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"dnsimple_record.foobar", "domain", "jack.ly"),
|
"dnsimple_record.foobar", "domain", domain),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"dnsimple_record.foobar", "value", "192.168.0.10"),
|
"dnsimple_record.foobar", "value", "192.168.0.10"),
|
||||||
),
|
),
|
||||||
|
@ -106,7 +108,7 @@ func testAccCheckDNSimpleRecordExists(n string, record *dnsimple.Record) resourc
|
||||||
|
|
||||||
const testAccCheckDNSimpleRecordConfig_basic = `
|
const testAccCheckDNSimpleRecordConfig_basic = `
|
||||||
resource "dnsimple_record" "foobar" {
|
resource "dnsimple_record" "foobar" {
|
||||||
domain = "jack.ly"
|
domain = "%s"
|
||||||
|
|
||||||
name = "terraform"
|
name = "terraform"
|
||||||
value = "192.168.0.10"
|
value = "192.168.0.10"
|
||||||
|
|
|
@ -73,4 +73,8 @@ func testAccPreCheck(t *testing.T) {
|
||||||
if v := os.Getenv("DNSIMPLE_TOKEN"); v == "" {
|
if v := os.Getenv("DNSIMPLE_TOKEN"); v == "" {
|
||||||
t.Fatal("DNSIMPLE_TOKEN must be set for acceptance tests")
|
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.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue