Skip to content

Fixed ECS TestAccECSClusterCapacityProviders_disappears acc test - #50374

Open
garutilorenzo wants to merge 7 commits into
hashicorp:mainfrom
garutilorenzo:fix/ecs-cluster-capacity-providers-disappears-test
Open

garutilorenzo wants to merge 7 commits into
hashicorp:mainfrom
garutilorenzo:fix/ecs-cluster-capacity-providers-disappears-test

Conversation

@garutilorenzo

@garutilorenzo garutilorenzo commented Oct 9, 2026 •

Copy link
Copy Markdown

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

No

Description

Fixed TestAccECSClusterCapacityProviders_disappears function to handle correctly the Post-apply refresh plan check(s)

== NAME  TestAccECSClusterCapacityProviders_disappears
    cluster_capacity_providers_test.go:61: Step 1/1 error: Post-apply refresh plan check(s) failed:
        'aws_ecs_cluster_capacity_providers.test' - expected Create, got action(s): [update]

Relations

Relates PR #50360 fix acc tests

Output from Acceptance Testing

acc tests not fun for this PR

…e correctly the Post-apply refresh plan check(s)
@garutilorenzo
garutilorenzo requested a review from a team as a code owner October 9, 2026 09:07
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions Bot added needs-triage Waiting for first response or review from a maintainer. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ecs Issues and PRs that pertain to the ecs service. size/XS Managed by automation to categorize the size of a PR. labels Oct 9, 2026
Moved comment explaining the behavior of the ECS cluster capacity providers resource during deletion and state management.
…e correctly the Post-apply refresh plan check(s)
…e correctly the Post-apply refresh plan check(s)
@jar-b jar-b removed the needs-triage Waiting for first response or review from a maintainer. label Oct 9, 2026
jar-b added 2 commits October 9, 2026 11:35
…e/deleted clusters

Previously attempts to delete capacity providers linked to a deleted cluster would result in the resource hanging for the full 10 minute retry window before failing. Errors indicating the cluster is not ACTIVE now return immediately for delete operations. Added a new `_disappears_Cluster` test case to verify the behavior.

```console
% make t K=ecs T=TestAccECSClusterCapacityProviders_disappears
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 fix/ecs-cluster-capacity-providers-disappears-test 🌿...
TF_ACC=1 go1.26.8 test ./internal/service/ecs/... -v -count 1 -parallel 20 -run='TestAccECSClusterCapacityProviders_disappears'  -timeout 360m -vet=off -buildvcs=false
2026/10/09 11:20:26 Creating Terraform AWS Provider (SDKv2-style)...
2026/10/09 11:20:26 Initializing Terraform AWS Provider (SDKv2-style)...

--- PASS: TestAccECSClusterCapacityProviders_disappears_Cluster (38.12s)
--- PASS: TestAccECSClusterCapacityProviders_disappears (58.21s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ecs        66.409s
```
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@github-actions github-actions Bot added size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Oct 9, 2026
@jar-b

jar-b commented Oct 9, 2026

Copy link
Copy Markdown
Member

/test PATTERN=TestAccECSClusterCapacityProviders_

@jar-b
jar-b requested a balanced review from Copilot October 9, 2026 15:40
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Automated tests have been triggered for package ecs. Results will be posted when complete.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new acceptance test lacks the standard ECS partition-availability precheck.

1 open finding
What changed in this PR

Fixes ECS cluster capacity-provider disappearance handling and inactive-cluster deletion.

Changes:

  • Expects updates after capacity providers disappear.
  • Handles deleted parent clusters without retrying inactive-cluster errors.
  • Adds parent-cluster disappearance coverage.
File Description
.changelog/​50374.txt Documents the bug fix.
internal/​service/​ecs/​cluster_capacity_providers.go Adjusts deletion retry/error handling.
internal/​service/​ecs/​cluster_capacity_providers_test.go Updates and expands disappearance tests.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/service/ecs/cluster_capacity_providers_test.go
@jar-b

jar-b commented Oct 9, 2026

Copy link
Copy Markdown
Member

Thanks for correcting the assertions in the _disappears test, @garutilorenzo!

While reviewing I added a related test which deletes the parent cluster out-of-band to verify the behavior in that scenario. The new test uncovered a bug which caused the capacity provider resource to hang during deletion when the parent cluster was no longer present. I've fixed that as part of this change and will merge once CI completes and the full test suite results are posted.

@hc-github-team-terraform-aws

Copy link
Copy Markdown
Collaborator

Latest automated test results:

% TF_ACC=1 go test './internal/service/ecs/...' -count=1 -json -v -run='TestAccECSClusterCapacityProviders_' -parallel '20' -timeout=0 -vet=off -buildvcs=false

TestAccECSClusterCapacityProviders_basic: [PASS] 70.78s
TestAccECSClusterCapacityProviders_disappears: [PASS] 74.14s
TestAccECSClusterCapacityProviders_disappears_Cluster: [PASS] 56.43s
TestAccECSClusterCapacityProviders_defaults: [PASS] 71.11s
TestAccECSClusterCapacityProviders_destroy: [FAIL] 161.06s

------- Stdout: -------
    cluster_capacity_providers_test.go:166: Step 1/2 error: Check failed: Check 2/2 error: RegisteredContainerInstancesCount = 0, want 2
--- FAIL: TestAccECSClusterCapacityProviders_destroy (161.06s)
TestAccECSClusterCapacityProviders_Update_capacityProviders: [PASS] 144s
TestAccECSClusterCapacityProviders_Update_defaultStrategy: [PASS] 143.47s

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

service/ecs Issues and PRs that pertain to the ecs service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants