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

aws_sagemaker_domain: New failing test cases for open bugs #35505

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

brakf
Copy link

@brakf brakf commented Jan 26, 2024

Description

Contributing two failing test cases for two bugs that we identified:

  1. studio_web_portal cannot be disabled. It throws an error, that indicates that the DefaultLandingUri doesn't match the expected value (Issue: [Bug]: Reverting to Sagemaker Studio Classic requires additional parameter #35504 )
  2. custom_file_system_config is not removed properly. Need to send an empty array to the API to remove it. (Issue: [Bug]: Removing efs file system by removing custom_file_system_config block does not work #35503 )

Relations

Relates #35503
Relates #35504

References

https://docs.aws.amazon.com/sagemaker/latest/dg/studio-updated-migrate.html#:~:text=StudioWebPortal%3A%20DISABLED

Output from Acceptance Testing

The tests fail as expected:

% Running tool: /usr/local/go/bin/go test -timeout 120m -run ^TestAccDomain_studioWebPortal$ github.com/hashicorp/terraform-provider-aws/internal/service/sagemaker -test.v

=== RUN   TestAccDomain_studioWebPortal
2024-01-26T15:51:25.532+0100 [ERROR] sdk.proto: Response contains error diagnostic:
  diagnostic_summary=
  | updating SageMaker Domain: ValidationException: StudioWebPortal is disabled for this domain/user.
  | \tstatus code: 400, request id: fe98acde-996b-4aab-aa78-68f49d7483a7
   diagnostic_detail="" diagnostic_severity=ERROR tf_proto_version=5.4 tf_rpc=ApplyResourceChange tf_provider_addr=registry.terraform.io/hashicorp/aws tf_resource_type=aws_sagemaker_domain tf_req_id=7902c77d-8391-49fe-2958-499d973903a1
2024-01-26T15:51:25.564+0100 [WARN]  sdk.helper_resource: Error running Terraform CLI command: test_step_number=3 test_working_directory=/var/folders/w7/9kn8wg7d1f7fcj8709265ql40000gp/T/plugintest1161867331 test_terraform_path=/Users/fabianbrakowski/bin/terraform test_name=TestAccDomain_studioWebPortal
  error=
  | exit status 1
  |
  | Error: updating SageMaker Domain: ValidationException: StudioWebPortal is disabled for this domain/user.
  | \tstatus code: 400, request id: fe98acde-996b-4aab-aa78-68f49d7483a7
  |
  |   with aws_sagemaker_domain.test,
  |   on terraform_plugin_test.tf line 66, in resource "aws_sagemaker_domain" "test":
  |   66: resource "aws_sagemaker_domain" "test" {
  |

2024-01-26T15:51:25.564+0100 [ERROR] sdk.helper_resource: Unexpected error: test_name=TestAccDomain_studioWebPortal test_step_number=3 test_working_directory=/var/folders/w7/9kn8wg7d1f7fcj8709265ql40000gp/T/plugintest1161867331
  error=
  | Error running apply: exit status 1
  |
  | Error: updating SageMaker Domain: ValidationException: StudioWebPortal is disabled for this domain/user.
  | \tstatus code: 400, request id: fe98acde-996b-4aab-aa78-68f49d7483a7
  |
  |   with aws_sagemaker_domain.test,
  |   on terraform_plugin_test.tf line 66, in resource "aws_sagemaker_domain" "test":
  |   66: resource "aws_sagemaker_domain" "test" {
  |
   test_terraform_path=/Users/fabianbrakowski/bin/terraform
    /Users/fabianbrakowski/code/hashicorp/terraform-provider-aws/internal/service/sagemaker/domain_test.go:1121: Step 3/4 error: Error running apply: exit status 1

        Error: updating SageMaker Domain: ValidationException: StudioWebPortal is disabled for this domain/user.
                status code: 400, request id: fe98acde-996b-4aab-aa78-68f49d7483a7

          with aws_sagemaker_domain.test,
          on terraform_plugin_test.tf line 66, in resource "aws_sagemaker_domain" "test":
          66: resource "aws_sagemaker_domain" "test" {

2024-01-26T15:51:26.767+0100 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_req_id=331da447-52e1-2a4a-f7d2-be169f25d34a tf_rpc=ConfigureProvider tf_mux_provider="*schema.GRPCProviderServer" tf_provider_addr=registry.terraform.io/hashicorp/aws
--- FAIL: TestAccDomain_studioWebPortal (248.53s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/sagemaker  255.008s




% Running tool: /usr/local/go/bin/go test -timeout 120m -run ^TestAccDomain_efs$ github.com/hashicorp/terraform-provider-aws/internal/service/sagemaker -test.v

=== RUN   TestAccDomain_efs
2024-01-26T16:42:41.288+0100 [ERROR] sdk.helper_resource: Unexpected error: error="Check failed: Check 3/3 error: aws_sagemaker_domain.test: Attribute 'default_user_settings.0.custom_file_system_config.#' expected \"0\", got \"1\"" test_working_directory=/var/folders/w7/9kn8wg7d1f7fcj8709265ql40000gp/T/plugintest4203844875 test_name=TestAccDomain_efs test_terraform_path=/Users/fabianbrakowski/bin/terraform test_step_number=3
    /Users/fabianbrakowski/code/hashicorp/terraform-provider-aws/internal/service/sagemaker/domain_test.go:1072: Step 3/3 error: Check failed: Check 3/3 error: aws_sagemaker_domain.test: Attribute 'default_user_settings.0.custom_file_system_config.#' expected "0", got "1"
2024-01-26T16:42:42.463+0100 [WARN]  sdk.helper_schema: Previously configured provider being re-configured. This can cause issues in concurrent testing if the configurations are not equal.: tf_req_id=f3c2ed3d-1306-c511-40b4-7de73d7ef242 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=ConfigureProvider tf_mux_provider="*schema.GRPCProviderServer"
--- FAIL: TestAccDomain_efs (332.12s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/sagemaker	338.584s
FAIL

...

Fabian Brakowski added 2 commits January 26, 2024 16:00
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 size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/sagemaker Issues and PRs that pertain to the sagemaker service. labels Jan 26, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Jan 26, 2024
@brakf brakf marked this pull request as ready for review January 26, 2024 16:13
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 26, 2024
@damianslee
Copy link

there are a lot of cases where removing items in sagemaker domain do not delete the resource in aws. most cases where there is a list of items related to the domain

i was going to raise a issue for removing custom images from kernel_gateway_app_settings and jupyter_lab_app_settings, does not remove the custom image.

@deepakbshetty
Copy link
Contributor

deepakbshetty commented Feb 7, 2024

there are a lot of cases where removing items in sagemaker domain do not delete the resource in aws. most cases where there is a list of items related to the domain

i was going to raise a issue for removing custom images from kernel_gateway_app_settings and jupyter_lab_app_settings, does not remove the custom image.

A lot of this boils down to how Update Domain API which has abilities to perform selective updates - ex. default_user_settings and just jupyter_server_app_settings and selective attributes within the block. The provider code itself has some issues around handling empty lists or list of dicts ex, security_groups , security_group_ids , lifecycle_config_arns, custom_images etc. and ignores them instead of feeding empty list to Update Domain API.

A workaround at the moment, is not to have the list empty. I have been trying to develop a fix for this but is quite elaborate one due to the nature of nested settings block and will take few weeks before a PR makes its way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/sagemaker Issues and PRs that pertain to the sagemaker service. size/M 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