From c202a955c567ac35ad1a5aed71136ca986740abd Mon Sep 17 00:00:00 2001 From: Robin Breathe Date: Sat, 4 May 2024 15:57:23 +0200 Subject: [PATCH] fix: build/tests --- .github/workflows/test.yml | 6 +----- internal/helpers/mergo.go | 7 ++++++- internal/provider/provider_test.go | 12 +++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b32bb5..c910177 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -65,11 +65,7 @@ jobs: matrix: # list whatever Terraform versions here you would like to support terraform: - - '1.0.*' - - '1.1.*' - - '1.2.*' - - '1.3.*' - - '1.4.*' + - '1.8.*' steps: - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 diff --git a/internal/helpers/mergo.go b/internal/helpers/mergo.go index 8be67be..2a6ac81 100644 --- a/internal/helpers/mergo.go +++ b/internal/helpers/mergo.go @@ -18,7 +18,12 @@ func Mergo(ctx context.Context, objs []types.Dynamic, opts ...func(*mergo.Config diags.Append(diag.NewErrorDiagnostic(fmt.Sprintf("Error encoding argument %d", i+1), err.Error())) return } - maps[i] = x.(map[string]any) + if y, ok := x.(map[string]any); !ok { + diags.Append(diag.NewErrorDiagnostic(fmt.Sprintf("Error converting argument %d to map", i+1), fmt.Sprintf("unexpected type: %T for value %#v", x, x))) + return + } else { + maps[i] = y + } } dst := maps[0] diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index a51a63e..a8ee892 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -4,8 +4,6 @@ package provider import ( - "testing" - "github.com/hashicorp/terraform-plugin-framework/providerserver" "github.com/hashicorp/terraform-plugin-go/tfprotov6" ) @@ -18,8 +16,8 @@ var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServe "deepmerge": providerserver.NewProtocol6WithError(New("test")()), } -func testAccPreCheck(t *testing.T) { - // You can add code here to run prior to any test case execution, for example assertions - // about the appropriate environment variables being set are common to see in a pre-check - // function. -} +// func testAccPreCheck(t *testing.T) { +// // You can add code here to run prior to any test case execution, for example assertions +// // about the appropriate environment variables being set are common to see in a pre-check +// // function. +// }