From b8df47c9ac2a9b586c062b4336d3a18849a676d2 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 14 Oct 2020 14:05:41 -0400 Subject: [PATCH 1/4] add struct field names --- backend/remote-state/s3/backend_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/remote-state/s3/backend_test.go b/backend/remote-state/s3/backend_test.go index 13f08fea4..f3fccba61 100644 --- a/backend/remote-state/s3/backend_test.go +++ b/backend/remote-state/s3/backend_test.go @@ -121,7 +121,7 @@ func TestBackendConfig_AssumeRole(t *testing.T) { Description: "assume_role_duration_seconds", MockStsEndpoints: []*awsbase.MockEndpoint{ { - Request: &awsbase.MockRequest{"POST", "/", url.Values{ + Request: &awsbase.MockRequest{Method: "POST", Uri: "/", Body: url.Values{ "Action": []string{"AssumeRole"}, "DurationSeconds": []string{"3600"}, "RoleArn": []string{awsbase.MockStsAssumeRoleArn}, @@ -148,7 +148,7 @@ func TestBackendConfig_AssumeRole(t *testing.T) { Description: "external_id", MockStsEndpoints: []*awsbase.MockEndpoint{ { - Request: &awsbase.MockRequest{"POST", "/", url.Values{ + Request: &awsbase.MockRequest{Method: "POST", Uri: "/", Body: url.Values{ "Action": []string{"AssumeRole"}, "DurationSeconds": []string{"900"}, "ExternalId": []string{awsbase.MockStsAssumeRoleExternalId}, @@ -176,7 +176,7 @@ func TestBackendConfig_AssumeRole(t *testing.T) { Description: "assume_role_policy", MockStsEndpoints: []*awsbase.MockEndpoint{ { - Request: &awsbase.MockRequest{"POST", "/", url.Values{ + Request: &awsbase.MockRequest{Method: "POST", Uri: "/", Body: url.Values{ "Action": []string{"AssumeRole"}, "DurationSeconds": []string{"900"}, "Policy": []string{awsbase.MockStsAssumeRolePolicy}, From 5e9425b56247db2d9e9221e8f2fc8a35790873f6 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 14 Oct 2020 14:06:00 -0400 Subject: [PATCH 2/4] unreachable --- backend/remote/backend_common.go | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/remote/backend_common.go b/backend/remote/backend_common.go index e8d31f7c8..2b0ee9083 100644 --- a/backend/remote/backend_common.go +++ b/backend/remote/backend_common.go @@ -328,7 +328,6 @@ func (b *Remote) costEstimate(stopCtx, cancelCtx context.Context, op *backend.Op return fmt.Errorf("Unknown or unexpected cost estimate state: %s", ce.Status) } } - return nil } func (b *Remote) checkPolicy(stopCtx, cancelCtx context.Context, op *backend.Operation, r *tfe.Run) error { From c61a893590ca93ac1df13f6fdd8c1073654ac5aa Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 14 Oct 2020 14:06:14 -0400 Subject: [PATCH 3/4] unused tests these are no longer relevant --- .../providers/test/resource_defaults_test.go | 27 ------- builtin/providers/test/splat_flatten_test.go | 79 ------------------- 2 files changed, 106 deletions(-) delete mode 100644 builtin/providers/test/splat_flatten_test.go diff --git a/builtin/providers/test/resource_defaults_test.go b/builtin/providers/test/resource_defaults_test.go index eecb00638..8aabd4482 100644 --- a/builtin/providers/test/resource_defaults_test.go +++ b/builtin/providers/test/resource_defaults_test.go @@ -148,33 +148,6 @@ resource "test_resource_defaults" "foo" { }) } -func TestResourceDefaults_import(t *testing.T) { - // FIXME: The ReadResource after ImportResourceState sin't returning the - // complete state, yet the later refresh does. - return - - resource.UnitTest(t, resource.TestCase{ - Providers: testAccProviders, - CheckDestroy: testAccCheckResourceDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: strings.TrimSpace(` -resource "test_resource_defaults" "foo" { - nested { - optional = "val" - } -} - `), - }, - { - ImportState: true, - ImportStateVerify: true, - ResourceName: "test_resource_defaults.foo", - }, - }, - }) -} - func TestDefaults_emptyString(t *testing.T) { config := ` resource "test_resource_defaults" "test" { diff --git a/builtin/providers/test/splat_flatten_test.go b/builtin/providers/test/splat_flatten_test.go deleted file mode 100644 index 08551ae6d..000000000 --- a/builtin/providers/test/splat_flatten_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package test - -import ( - "errors" - "testing" - - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" -) - -// This is actually a test of some core functionality in conjunction with -// helper/schema, rather than of the test provider itself. -// -// Here we're just verifying that unknown splats get flattened when assigned -// to list and set attributes. A variety of other situations are tested in -// an apply context test in the core package, but for this part we lean on -// helper/schema and thus need to exercise it at a higher level. - -func TestSplatFlatten(t *testing.T) { - return - resource.UnitTest(t, resource.TestCase{ - Providers: testAccProviders, - CheckDestroy: testAccCheckResourceDestroy, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: ` -resource "test_resource" "source" { - required = "foo ${count.index}" - required_map = { - key = "value" - } - count = 3 -} - -resource "test_resource" "splatted" { - # This legacy form of splatting into a list is still supported for - # backward-compatibility but no longer suggested. - set = ["${test_resource.source.*.computed_from_required}"] - list = ["${test_resource.source.*.computed_from_required}"] - - required = "yep" - required_map = { - key = "value" - } -} - `, - Check: func(s *terraform.State) error { - gotAttrs := s.RootModule().Resources["test_resource.splatted"].Primary.Attributes - t.Logf("attrs %#v", gotAttrs) - wantAttrs := map[string]string{ - "list.#": "3", - "list.0": "foo 0", - "list.1": "foo 1", - "list.2": "foo 2", - - // This depends on the default set hash implementation. - // If that changes, these keys will need to be updated. - "set.#": "3", - "set.1136855734": "foo 0", - "set.885275168": "foo 1", - "set.2915920794": "foo 2", - } - errored := false - for k, want := range wantAttrs { - got := gotAttrs[k] - if got != want { - t.Errorf("Wrong %s value %q; want %q", k, got, want) - errored = true - } - } - if errored { - return errors.New("incorrect attribute values") - } - return nil - }, - }, - }, - }) -} From 98d01615f668ea8f9fba9cff32814ef16d12753b Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 14 Oct 2020 14:09:17 -0400 Subject: [PATCH 4/4] unreachable --- plugin/resource_provisioner.go | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/resource_provisioner.go b/plugin/resource_provisioner.go index f0cc341f1..5bebc4c61 100644 --- a/plugin/resource_provisioner.go +++ b/plugin/resource_provisioner.go @@ -34,7 +34,6 @@ type ResourceProvisioner struct { func (p *ResourceProvisioner) GetConfigSchema() (*configschema.Block, error) { panic("not implemented") - return nil, nil } func (p *ResourceProvisioner) Validate(c *terraform.ResourceConfig) ([]string, []error) {