opentofu/backend/init/deprecate_test.go
Martin Atkins 5782357c28 backend: Update interface and implementations for new config loader
The new config loader requires some steps to happen in a different
order, particularly in regard to knowing the schema in order to
decode the configuration.

Here we lean directly on the configschema package, rather than
on helper/schema.Backend as before, because it's generally
sufficient for our needs here and this prepares us for the
helper/schema package later moving out into its own repository
to seed a "plugin SDK".
2018-10-16 18:39:12 -07:00

31 lines
655 B
Go

package init
import (
"testing"
"github.com/hashicorp/terraform/backend/remote-state/inmem"
"github.com/zclconf/go-cty/cty"
)
func TestDeprecateBackend(t *testing.T) {
deprecateMessage := "deprecated backend"
deprecatedBackend := deprecateBackend(
inmem.New(),
deprecateMessage,
)
diags := deprecatedBackend.ValidateConfig(cty.EmptyObjectVal)
if len(diags) != 1 {
t.Errorf("got %d diagnostics; want 1", len(diags))
for _, diag := range diags {
t.Errorf("- %s", diag)
}
return
}
desc := diags[0].Description()
if desc.Summary != deprecateMessage {
t.Fatalf("wrong message %q; want %q", desc.Summary, deprecateMessage)
}
}