github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/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/zclconf/go-cty/cty" 8 ) 9 10 func TestDeprecateBackend(t *testing.T) { 11 deprecateMessage := "deprecated backend" 12 deprecatedBackend := deprecateBackend( 13 inmem.New(), 14 deprecateMessage, 15 ) 16 17 _, diags := deprecatedBackend.PrepareConfig(cty.EmptyObjectVal) 18 if len(diags) != 1 { 19 t.Errorf("got %d diagnostics; want 1", len(diags)) 20 for _, diag := range diags { 21 t.Errorf("- %s", diag) 22 } 23 return 24 } 25 26 desc := diags[0].Description() 27 if desc.Summary != deprecateMessage { 28 t.Fatalf("wrong message %q; want %q", desc.Summary, deprecateMessage) 29 } 30 }