github.com/codeherentuk/terraform@v0.11.12-beta1/backend/init/deprecate_test.go (about) 1 package init 2 3 import ( 4 "testing" 5 6 "github.com/hashicorp/terraform/backend/remote-state/inmem" 7 "github.com/hashicorp/terraform/terraform" 8 ) 9 10 func TestDeprecateBackend(t *testing.T) { 11 deprecateMessage := "deprecated backend" 12 deprecatedBackend := deprecateBackend( 13 inmem.New(), 14 deprecateMessage, 15 )() 16 17 warns, errs := deprecatedBackend.Validate(&terraform.ResourceConfig{}) 18 if errs != nil { 19 for _, err := range errs { 20 t.Error(err) 21 } 22 t.Fatal("validation errors") 23 } 24 25 if len(warns) != 1 { 26 t.Fatalf("expected 1 warning, got %q", warns) 27 } 28 29 if warns[0] != deprecateMessage { 30 t.Fatalf("expected %q, got %q", deprecateMessage, warns[0]) 31 } 32 }