From a1e9a0b28d8df33736c2edc7445f217be4d06a23 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Sun, 30 Sep 2018 08:06:31 -0700 Subject: [PATCH] command: Update plugins_test.go for new provider types This only makes it compile. It does not yet ensure that the tests pass. --- command/plugins_test.go | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/command/plugins_test.go b/command/plugins_test.go index 086a30d9c4..28977044f9 100644 --- a/command/plugins_test.go +++ b/command/plugins_test.go @@ -7,7 +7,9 @@ import ( "reflect" "testing" + "github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/plugin/discovery" + "github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/terraform" ) @@ -20,16 +22,16 @@ func TestMultiVersionProviderResolver(t *testing.T) { }) resolver := &multiVersionProviderResolver{ - Internal: map[string]terraform.ResourceProviderFactory{ - "internal": func() (terraform.ResourceProvider, error) { - return &terraform.MockResourceProvider{ - ResourcesReturn: []terraform.ResourceType{ - { - Name: "internal_foo", + Internal: map[string]providers.Factory{ + "internal": providers.FactoryFixed( + &terraform.MockProvider{ + GetSchemaReturn: &terraform.ProviderSchema{ + ResourceTypes: map[string]*configschema.Block{ + "internal_foo": {}, }, }, - }, nil - }, + }, + ), }, Available: available, } @@ -122,13 +124,8 @@ func TestInternalProviders(t *testing.T) { t.Fatal(err) } - dataSources := tfProvider.DataSources() - found := false - for _, ds := range dataSources { - if ds.Name == "terraform_remote_state" { - found = true - } - } + schema := tfProvider.GetSchema() + _, found := schema.DataSources["terraform_remote_state"] if !found { t.Errorf("didn't find terraform_remote_state in internal \"terraform\" provider") }