mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
13c34b16e8
This allows using legacy remote state backends with the new backend interface.
35 lines
600 B
Go
35 lines
600 B
Go
package legacy
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/backend"
|
|
"github.com/hashicorp/terraform/state/remote"
|
|
)
|
|
|
|
func TestInit(t *testing.T) {
|
|
m := make(map[string]func() backend.Backend)
|
|
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) {
|
|
m := make(map[string]func() backend.Backend)
|
|
m["local"] = nil
|
|
Init(m)
|
|
|
|
if v, ok := m["local"]; !ok || v != nil {
|
|
t.Fatalf("bad: %#v", m)
|
|
}
|
|
}
|