diff --git a/.teamcity/scripts/provider_tests/acceptance_tests.sh b/.teamcity/scripts/provider_tests/acceptance_tests.sh index 86f8286a2d5..2329d81f456 100644 --- a/.teamcity/scripts/provider_tests/acceptance_tests.sh +++ b/.teamcity/scripts/provider_tests/acceptance_tests.sh @@ -61,4 +61,4 @@ TF_ACC=1 go test \ ./internal/types/... \ ./internal/vault/... \ ./internal/verify/... \ - -json -v -count=1 -parallel "%ACCTEST_PARALLELISM%" -timeout=0 -run=TestAcc + -json -count=1 -parallel "%ACCTEST_PARALLELISM%" -timeout=0 -run=TestAcc diff --git a/.teamcity/scripts/service_tests/acceptance_tests.sh b/.teamcity/scripts/service_tests/acceptance_tests.sh index e8a14f220b1..07fabf7e88c 100644 --- a/.teamcity/scripts/service_tests/acceptance_tests.sh +++ b/.teamcity/scripts/service_tests/acceptance_tests.sh @@ -4,6 +4,7 @@ set -euo pipefail TEST_LIST=$(./test-binary -test.list="%TEST_PATTERN%" 2>/dev/null) +# shellcheck disable=2157 # This isn't a constant string, it's a TeamCity variable substitution if [[ -n "%TEST_EXCLUDE_PATTERN%" ]]; then TEST_LIST=$(echo "${TEST_LIST}" | grep -vE "%TEST_EXCLUDE_PATTERN%") fi diff --git a/internal/generate/teamcity/acceptance_tests.tmpl b/internal/generate/teamcity/acceptance_tests.tmpl index f56c31641a5..d14b7912861 100644 --- a/internal/generate/teamcity/acceptance_tests.tmpl +++ b/internal/generate/teamcity/acceptance_tests.tmpl @@ -36,4 +36,4 @@ TF_ACC=1 go test \ {{- range . }} ./internal/{{ . }}/... \ {{- end }} - -json -v -count=1 -parallel "%ACCTEST_PARALLELISM%" -timeout=0 -run=TestAcc + -json -count=1 -parallel "%ACCTEST_PARALLELISM%" -timeout=0 -run=TestAcc diff --git a/internal/provider/provider_acc_test.go b/internal/provider/provider_acc_test.go index fd0e8e9b169..31fbf4d51b7 100644 --- a/internal/provider/provider_acc_test.go +++ b/internal/provider/provider_acc_test.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "reflect" - "strings" "testing" "github.com/aws/aws-sdk-go-v2/aws" @@ -159,32 +158,6 @@ func TestAccProvider_DefaultAndIgnoreTags_emptyBlocks(t *testing.T) { }) } -func TestAccProvider_endpoints(t *testing.T) { - ctx := acctest.Context(t) - var provider *schema.Provider - var endpoints strings.Builder - - // Initialize each endpoint configuration with matching name and value - for _, serviceKey := range names.ProviderPackages() { - endpoints.WriteString(fmt.Sprintf("%s = \"http://%s\"\n", serviceKey, serviceKey)) - } - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t) }, - ErrorCheck: acctest.ErrorCheck(t), - ProtoV5ProviderFactories: testAccProtoV5ProviderFactoriesInternal(ctx, t, &provider), - CheckDestroy: nil, - Steps: []resource.TestStep{ - { - Config: testAccProviderConfig_endpoints(endpoints.String()), - Check: resource.ComposeTestCheckFunc( - testAccCheckEndpoints(ctx, &provider), - ), - }, - }, - }) -} - func TestAccProvider_customEndpoint(t *testing.T) { ctx := acctest.Context(t) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -508,6 +481,9 @@ func TestAccProvider_IgnoreTagsKeyPrefixes_envVarMerged(t *testing.T) { } func TestAccProvider_Region_c2s(t *testing.T) { + // When using `AWS_PROFILE` for authentication, `skip_credentials_validation` is ignored + // https://github.com/hashicorp/aws-sdk-go-base/issues/453 + t.Skip() ctx := acctest.Context(t) var provider *schema.Provider @@ -531,6 +507,9 @@ func TestAccProvider_Region_c2s(t *testing.T) { } func TestAccProvider_Region_china(t *testing.T) { + // When using `AWS_PROFILE` for authentication, `skip_credentials_validation` is ignored + // https://github.com/hashicorp/aws-sdk-go-base/issues/453 + t.Skip() ctx := acctest.Context(t) var provider *schema.Provider @@ -554,6 +533,9 @@ func TestAccProvider_Region_china(t *testing.T) { } func TestAccProvider_Region_commercial(t *testing.T) { + // When using `AWS_PROFILE` for authentication, `skip_credentials_validation` is ignored + // https://github.com/hashicorp/aws-sdk-go-base/issues/453 + t.Skip() ctx := acctest.Context(t) var provider *schema.Provider @@ -577,6 +559,9 @@ func TestAccProvider_Region_commercial(t *testing.T) { } func TestAccProvider_Region_govCloud(t *testing.T) { + // When using `AWS_PROFILE` for authentication, `skip_credentials_validation` is ignored + // https://github.com/hashicorp/aws-sdk-go-base/issues/453 + t.Skip() ctx := acctest.Context(t) var provider *schema.Provider @@ -600,6 +585,9 @@ func TestAccProvider_Region_govCloud(t *testing.T) { } func TestAccProvider_Region_sc2s(t *testing.T) { + // When using `AWS_PROFILE` for authentication, `skip_credentials_validation` is ignored + // https://github.com/hashicorp/aws-sdk-go-base/issues/453 + t.Skip() ctx := acctest.Context(t) var provider *schema.Provider @@ -623,6 +611,9 @@ func TestAccProvider_Region_sc2s(t *testing.T) { } func TestAccProvider_Region_stsRegion(t *testing.T) { + // When using `AWS_PROFILE` for authentication, `skip_credentials_validation` is ignored + // https://github.com/hashicorp/aws-sdk-go-base/issues/453 + t.Skip() ctx := acctest.Context(t) var provider *schema.Provider @@ -983,55 +974,6 @@ func testAccCheckProviderDefaultTags_Tags(ctx context.Context, t *testing.T, p * } } -func testAccCheckEndpoints(_ context.Context, p **schema.Provider) resource.TestCheckFunc { - return func(s *terraform.State) error { - if p == nil || *p == nil || (*p).Meta() == nil || (*p).Meta().(*conns.AWSClient) == nil { - return fmt.Errorf("provider not initialized") - } - - providerClient := (*p).Meta().(*conns.AWSClient) - - for _, serviceKey := range names.Aliases() { - methodName := serviceClient(serviceKey) - method := reflect.ValueOf(providerClient).MethodByName(methodName) - if !method.IsValid() { - continue - } - if method.Kind() != reflect.Func { - return fmt.Errorf("value %q is not a function", methodName) - } - if !funcHasConnFuncSignature(method) { - return fmt.Errorf("function %q does not match expected signature", methodName) - } - - result := method.Call([]reflect.Value{ - reflect.ValueOf(context.Background()), - }) - if l := len(result); l != 1 { - return fmt.Errorf("expected 1 result, got %d", l) - } - providerClientField := result[0] - - if !providerClientField.IsValid() { - return fmt.Errorf("unable to match conns.AWSClient struct field name for endpoint name: %s", serviceKey) - } - - if !reflect.Indirect(providerClientField).FieldByName("Config").IsValid() { - continue // currently unknown how to do this check for v2 clients - } - - actualEndpoint := reflect.Indirect(reflect.Indirect(providerClientField).FieldByName("Config").FieldByName("Endpoint")).String() - expectedEndpoint := fmt.Sprintf("http://%s", serviceKey) - - if actualEndpoint != expectedEndpoint { - return fmt.Errorf("expected endpoint (%s) value (%s), got: %s", serviceKey, expectedEndpoint, actualEndpoint) - } - } - - return nil - } -} - func testAccCheckUnusualEndpoints(_ context.Context, p **schema.Provider, unusual unusualEndpoint) resource.TestCheckFunc { return func(s *terraform.State) error { if p == nil || *p == nil || (*p).Meta() == nil || (*p).Meta().(*conns.AWSClient) == nil { @@ -1117,21 +1059,6 @@ data "aws_service" "provider_test" { } ` -func testAccProviderConfig_endpoints(endpoints string) string { - //lintignore:AT004 - return acctest.ConfigCompose(testAccProviderConfig_base, fmt.Sprintf(` -provider "aws" { - skip_credentials_validation = true - skip_metadata_api_check = true - skip_requesting_account_id = true - - endpoints { - %[1]s - } -} -`, endpoints)) -} - func testAccProviderConfig_customS3Endpoint(endpoint, rName string) string { //lintignore:AT004 return acctest.ConfigCompose(testAccProviderConfig_base, fmt.Sprintf(`