github.com/kcburge/terraform@v0.11.12-beta1/backend/legacy/legacy_test.go (about)

     1  package legacy
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/backend"
     7  	"github.com/hashicorp/terraform/state/remote"
     8  )
     9  
    10  func TestInit(t *testing.T) {
    11  	m := make(map[string]backend.InitFn)
    12  	Init(m)
    13  
    14  	for k, _ := range remote.BuiltinClients {
    15  		b, ok := m[k]
    16  		if !ok {
    17  			t.Fatalf("missing: %s", k)
    18  		}
    19  
    20  		if typ := b().(*Backend).Type; typ != k {
    21  			t.Fatalf("bad type: %s", typ)
    22  		}
    23  	}
    24  }
    25  
    26  func TestInit_ignoreExisting(t *testing.T) {
    27  	m := make(map[string]backend.InitFn)
    28  	m["local"] = nil
    29  	Init(m)
    30  
    31  	if v, ok := m["local"]; !ok || v != nil {
    32  		t.Fatalf("bad: %#v", m)
    33  	}
    34  }