Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fix for OpenSearch Serverless VPCE test #39454

Merged
merged 11 commits into from
Sep 24, 2024

Conversation

mumoumit
Copy link
Contributor

@mumoumit mumoumit commented Sep 23, 2024

Description

There was a bug in the test code. When I ran the Acceptance test for VPCE I got this error:

make testacc TESTS=TestAccOpenSearchServerlessVPCEndpoint PKG=opensearchserverless
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/opensearchserverless/... -v -count 1 -parallel 20 -run='TestAccOpenSearchServerlessVPCEndpoint'  -timeout 360m
=== RUN   TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== PAUSE TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_basic
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_basic
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_update
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_update
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_disappears
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_disappears
=== CONT  TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_update
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_disappears
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_basic
=== NAME  TestAccOpenSearchServerlessVPCEndpoint_securityGroups
    vpc_endpoint_test.go:72: Step 1/3 error: Check failed: Check 2/2 error: aws_opensearchserverless_vpc_endpoint.test: Attribute 'security_group_ids.#' not found
=== NAME  TestAccOpenSearchServerlessVPCEndpoint_basic
    vpc_endpoint_test.go:35: Step 1/2 error: Check failed: Check 3/3 error: aws_opensearchserverless_vpc_endpoint.test: Attribute 'security_group_ids.#' expected to be set
=== NAME  TestAccOpenSearchServerlessVPCEndpoint_update
    vpc_endpoint_test.go:118: Step 1/4 error: Check failed: Check 3/3 error: aws_opensearchserverless_vpc_endpoint.test: Attribute 'security_group_ids.#' not found
--- FAIL: TestAccOpenSearchServerlessVPCEndpoint_update (298.38s)
--- FAIL: TestAccOpenSearchServerlessVPCEndpoint_securityGroups (298.77s)
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_disappears (305.24s)
--- FAIL: TestAccOpenSearchServerlessVPCEndpoint_basic (338.38s)
--- PASS: TestAccOpenSearchServerlessVPCEndpointDataSource_basic (343.69s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/opensearchserverless     343.864s
FAIL
make: *** [testacc] Error 1

Relations

Closes #33603.
Closes #39021.

Output from Acceptance Testing

% make testacc TESTS=TestAccOpenSearchServerlessVPCEndpoint PKG=opensearchserverless
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/opensearchserverless/... -v -count 1 -parallel 20 -run='TestAccOpenSearchServerlessVPCEndpoint'  -timeout 360m
=== RUN   TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== PAUSE TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_basic
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_basic
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_update
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_update
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_disappears
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_disappears
=== CONT  TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_update
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_basic
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_disappears
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_securityGroups
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_basic (326.96s)
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_disappears (332.66s)
--- PASS: TestAccOpenSearchServerlessVPCEndpointDataSource_basic (334.52s)
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_securityGroups (404.37s)
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_update (519.35s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/opensearchserverless 519.529s

@mumoumit mumoumit requested a review from a team as a code owner September 23, 2024 20:24
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • 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 tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/opensearchserverless Issues and PRs that pertain to the opensearchserverless service. needs-triage Waiting for first response or review from a maintainer. labels Sep 23, 2024
@jar-b jar-b removed the needs-triage Waiting for first response or review from a maintainer. label Sep 23, 2024
@ewbankkit
Copy link
Contributor

We are seeing these failures in CI too:

=== RUN   TestAccOpenSearchServerlessVPCEndpoint_basic
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_basic
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_basic
    vpc_endpoint_test.go:35: Step 1/2 error: Check failed: Check 3/3 error: aws_opensearchserverless_vpc_endpoint.test: Attribute 'security_group_ids.#' not found
--- FAIL: TestAccOpenSearchServerlessVPCEndpoint_basic (434.48s)
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_securityGroups
    vpc_endpoint_test.go:71: Step 1/3 error: Check failed: Check 2/2 error: aws_opensearchserverless_vpc_endpoint.test: Attribute 'security_group_ids.#' not found
--- FAIL: TestAccOpenSearchServerlessVPCEndpoint_securityGroups (449.72s)
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_update
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_update
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_update
    vpc_endpoint_test.go:117: Step 1/4 error: Check failed: Check 3/3 error: aws_opensearchserverless_vpc_endpoint.test: Attribute 'security_group_ids.#' not found
--- FAIL: TestAccOpenSearchServerlessVPCEndpoint_update (402.41s)

@ewbankkit ewbankkit self-assigned this Sep 24, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 24, 2024
@mumoumit
Copy link
Contributor Author

@ewbankkit so are you looking into it then?
Need this tests to be fixed so that we can merge this : #39021

We had introduced 2 new fields in the BatchGetVPCEResponse and need this to get merged in terraform too.

@mumoumit
Copy link
Contributor Author

There was a linting error. So raised another commit to fix it.

ewbankkit and others added 5 commits September 24, 2024 12:53
The updated deprecation message now includes the impacted argument name,
providing clarity around what argument should be addressed.

```
│ Warning: Argument is deprecated
│
│   with aws_iam_role.test,
│   on main.tf line 33, in resource "aws_iam_role" "test":
│   33: resource "aws_iam_role" "test" {
│
│ The inline_policy argument is deprecated. Use the aws_iam_role_policy resource instead. If Terraform should exclusively manage all inline policy associations (the current behavior
│ of this argument), use the aws_iam_role_policies_exclusive resource as well.
```
Add fix for OpenSearch Serverless VPCE test
@mumoumit
Copy link
Contributor Author

Squashed the previous 2 commits into 1.

@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Sep 24, 2024
@github-actions github-actions bot added the generators Relates to code generators. label Sep 24, 2024
# Conflicts:
#	internal/service/opensearchserverless/vpc_endpoint_test.go
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccOpenSearchServerlessVPCEndpoint' PKG=opensearchserverless ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.7 test ./internal/service/opensearchserverless/... -v -count 1 -parallel 3  -run=TestAccOpenSearchServerlessVPCEndpoint -timeout 360m
=== RUN   TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== PAUSE TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_basic
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_basic
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_securityGroups
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_update
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_update
=== RUN   TestAccOpenSearchServerlessVPCEndpoint_disappears
=== PAUSE TestAccOpenSearchServerlessVPCEndpoint_disappears
=== CONT  TestAccOpenSearchServerlessVPCEndpointDataSource_basic
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_update
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_disappears
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_disappears (327.64s)
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_securityGroups
--- PASS: TestAccOpenSearchServerlessVPCEndpointDataSource_basic (366.21s)
=== CONT  TestAccOpenSearchServerlessVPCEndpoint_basic
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_update (574.60s)
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_basic (365.96s)
--- PASS: TestAccOpenSearchServerlessVPCEndpoint_securityGroups (455.89s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/opensearchserverless	788.962s

@ewbankkit
Copy link
Contributor

@mumoumit Thanks for the contribution 🎉 👏.
It turns out that BatchGetVpcEndpoint does not return the endpoints' security group IDs so we have to call the EC2 DescribeVpcEndpoints API directly.
I added the failure code and reason to the error returned when the VPC endpoint goes into failed state while waiting.

@ewbankkit ewbankkit merged commit 8257fc0 into hashicorp:main Sep 24, 2024
40 checks passed
@github-actions github-actions bot added this to the v5.69.0 milestone Sep 24, 2024
@mumoumit
Copy link
Contributor Author

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 26, 2024
Copy link

This functionality has been released in v5.69.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. generators Relates to code generators. service/opensearchserverless Issues and PRs that pertain to the opensearchserverless service. 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.

[Bug]: aws_opensearchserverless_vpc_endpoint fails when changing the 'name'
3 participants