provider/consul: Fixing test harness

This commit is contained in:
Armon Dadgar 2014-10-20 12:02:37 -07:00
parent dc3178e06a
commit 3e43eb5497
2 changed files with 10 additions and 2 deletions

View File

@ -78,7 +78,7 @@ func testAccCheckConsulKeysValue(n, attr, val string) resource.TestCheckFunc {
const testAccConsulKeysConfig = ` const testAccConsulKeysConfig = `
resource "consul_keys" "app" { resource "consul_keys" "app" {
datacenter = "nyc1" datacenter = "nyc3"
key { key {
name = "time" name = "time"
path = "global/time" path = "global/time"

View File

@ -3,6 +3,7 @@ package consul
import ( import (
"testing" "testing"
"github.com/armon/consul-api"
"github.com/hashicorp/terraform/config" "github.com/hashicorp/terraform/config"
"github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
@ -16,6 +17,13 @@ func init() {
testAccProviders = map[string]terraform.ResourceProvider{ testAccProviders = map[string]terraform.ResourceProvider{
"consul": testAccProvider, "consul": testAccProvider,
} }
// Use the demo address for the acceptance tests
testAccProvider.ConfigureFunc = func(d *schema.ResourceData) (interface{}, error) {
conf := consulapi.DefaultConfig()
conf.Address = "demo.consul.io:80"
return consulapi.NewClient(conf)
}
} }
func TestResourceProvider(t *testing.T) { func TestResourceProvider(t *testing.T) {
@ -33,7 +41,7 @@ func TestResourceProvider_Configure(t *testing.T) {
raw := map[string]interface{}{ raw := map[string]interface{}{
"address": "demo.consul.io:80", "address": "demo.consul.io:80",
"datacenter": "nyc1", "datacenter": "nyc3",
} }
rawConfig, err := config.NewRawConfig(raw) rawConfig, err := config.NewRawConfig(raw)