github.com/gavinw2006/hashicorp-terraform@v0.11.12-beta1/state/remote/etcd_test.go (about) 1 package remote 2 3 import ( 4 "fmt" 5 "os" 6 "testing" 7 "time" 8 ) 9 10 func TestEtcdClient_impl(t *testing.T) { 11 var _ Client = new(EtcdClient) 12 } 13 14 func TestEtcdClient(t *testing.T) { 15 endpoint := os.Getenv("ETCD_ENDPOINT") 16 if endpoint == "" { 17 t.Skipf("skipping; ETCD_ENDPOINT must be set") 18 } 19 20 config := map[string]string{ 21 "endpoints": endpoint, 22 "path": fmt.Sprintf("tf-unit/%s", time.Now().String()), 23 } 24 25 if username := os.Getenv("ETCD_USERNAME"); username != "" { 26 config["username"] = username 27 } 28 if password := os.Getenv("ETCD_PASSWORD"); password != "" { 29 config["password"] = password 30 } 31 32 client, err := etcdFactory(config) 33 if err != nil { 34 t.Fatalf("Error for valid config: %s", err) 35 } 36 37 testClient(t, client) 38 }