From b2132147b1d7bca14aeff4d253c59ecbe3364669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Wed, 12 Feb 2025 18:22:43 +0100 Subject: [PATCH] test: fix linting errors (#2921) * test: fix linting errors * Fix --- .golangci.yml | 1 - .../scwconfig/scw_config_data_source_test.go | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d20144db0..c72eda06e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -67,7 +67,6 @@ linters: - stylecheck # Stylecheck is a replacement for golint [fast: false, auto-fix: false] - tagalign # check that struct tags are well aligned [fast: true, auto-fix: true] - tagliatelle # Checks the struct tags. [fast: true, auto-fix: false] - - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 [fast: false, auto-fix: false] - testifylint # Checks usage of github.com/stretchr/testify. [fast: false, auto-fix: false] - testpackage # linter that makes you use a separate _test package [fast: true, auto-fix: false] - thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers [fast: false, auto-fix: false] diff --git a/internal/services/scwconfig/scw_config_data_source_test.go b/internal/services/scwconfig/scw_config_data_source_test.go index bf5cd3e8c..dcb999deb 100644 --- a/internal/services/scwconfig/scw_config_data_source_test.go +++ b/internal/services/scwconfig/scw_config_data_source_test.go @@ -30,7 +30,7 @@ func TestAccDataSourceConfig_ActiveProfile(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ProviderFactories: func() map[string]func() (*schema.Provider, error) { _ = os.Unsetenv("SCW_PROFILE") - _ = os.Setenv("SCW_CONFIG_PATH", "./testfixture/test_config.yaml") + t.Setenv("SCW_CONFIG_PATH", "./testfixture/test_config.yaml") metaDefault, err := meta.NewMeta(ctx, &meta.Config{ TerraformVersion: "terraform-tests", HTTPClient: tt.Meta.HTTPClient(), @@ -78,12 +78,12 @@ func TestAccDataSourceConfig_OtherProfile(t *testing.T) { ctx := context.Background() - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ProviderFactories: func() map[string]func() (*schema.Provider, error) { _ = os.Unsetenv("SCW_PROFILE") - _ = os.Setenv("SCW_CONFIG_PATH", "./testfixture/test_config.yaml") - _ = os.Setenv("SCW_PROFILE", "other") + t.Setenv("SCW_CONFIG_PATH", "./testfixture/test_config.yaml") + t.Setenv("SCW_PROFILE", "other") metaOther, err := meta.NewMeta(ctx, &meta.Config{ TerraformVersion: "terraform-tests", HTTPClient: tt.Meta.HTTPClient(), @@ -131,13 +131,13 @@ func TestAccDataSourceConfig_MixedProfile(t *testing.T) { ctx := context.Background() - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ProviderFactories: func() map[string]func() (*schema.Provider, error) { _ = os.Unsetenv("SCW_PROFILE") - _ = os.Setenv("SCW_CONFIG_PATH", "./testfixture/test_config.yaml") - _ = os.Setenv("SCW_PROFILE", "incomplete") - _ = os.Setenv("SCW_DEFAULT_PROJECT_ID", "77777777-7777-7777-7777-777777777777") + t.Setenv("SCW_CONFIG_PATH", "./testfixture/test_config.yaml") + t.Setenv("SCW_PROFILE", "incomplete") + t.Setenv("SCW_DEFAULT_PROJECT_ID", "77777777-7777-7777-7777-777777777777") metaMixed, err := meta.NewMeta(ctx, &meta.Config{ TerraformVersion: "terraform-tests", HTTPClient: tt.Meta.HTTPClient(),