mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-15 19:22:46 -06:00
5782357c28
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".
31 lines
655 B
Go
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)
|
|
}
|
|
}
|