2017-01-19 05:48:34 +01:00
|
|
|
package legacy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/backend"
|
|
|
|
"github.com/hashicorp/terraform/state/remote"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestInit(t *testing.T) {
|
2018-07-04 17:24:49 +02:00
|
|
|
m := make(map[string]backend.InitFn)
|
2017-01-19 05:48:34 +01:00
|
|
|
Init(m)
|
|
|
|
|
|
|
|
for k, _ := range remote.BuiltinClients {
|
|
|
|
b, ok := m[k]
|
|
|
|
if !ok {
|
|
|
|
t.Fatalf("missing: %s", k)
|
|
|
|
}
|
|
|
|
|
|
|
|
if typ := b().(*Backend).Type; typ != k {
|
|
|
|
t.Fatalf("bad type: %s", typ)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestInit_ignoreExisting(t *testing.T) {
|
2018-07-04 17:24:49 +02:00
|
|
|
m := make(map[string]backend.InitFn)
|
2017-01-19 05:48:34 +01:00
|
|
|
m["local"] = nil
|
|
|
|
Init(m)
|
|
|
|
|
|
|
|
if v, ok := m["local"]; !ok || v != nil {
|
|
|
|
t.Fatalf("bad: %#v", m)
|
|
|
|
}
|
|
|
|
}
|