Skip to content

Commit

Permalink
sagemaker/tests: Rename test
Browse files Browse the repository at this point in the history
YakDriver committed Nov 7, 2024
1 parent de7be56 commit 02f3e41
Showing 2 changed files with 10 additions and 36 deletions.
44 changes: 9 additions & 35 deletions internal/service/sagemaker/domain_test.go
Original file line number Diff line number Diff line change
@@ -730,7 +730,7 @@ func testAccDomain_rStudioServerProDomainSettings(t *testing.T) {
})
}

func testAccDomain_rStudioServerProDomainSettingsUpdate(t *testing.T) {
func testAccDomain_rStudioDomainDisabledNetworkUpdate(t *testing.T) {
ctx := acctest.Context(t)
var domain sagemaker.DescribeDomainOutput
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
@@ -743,24 +743,19 @@ func testAccDomain_rStudioServerProDomainSettingsUpdate(t *testing.T) {
CheckDestroy: testAccCheckDomainDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccDomainConfig_rStudioServerProDomainSettingsUpdate(rName, "PublicInternetOnly", "https://connect.domain.com", "https://package.domain.com"),
Config: testAccDomainConfig_rStudioDomainDisabledNetworkUpdate(rName, "PublicInternetOnly"),
Check: resource.ComposeTestCheckFunc(
testAccCheckDomainExists(ctx, resourceName, &domain),
resource.TestCheckResourceAttr(resourceName, "domain_settings.#", "1"),
resource.TestCheckResourceAttr(resourceName, "domain_settings.0.r_studio_server_pro_domain_settings.#", "1"),
resource.TestCheckResourceAttr(resourceName, "domain_settings.0.r_studio_server_pro_domain_settings.0.r_studio_connect_url", "https://connect.domain.com"),
resource.TestCheckResourceAttr(resourceName, "domain_settings.0.r_studio_server_pro_domain_settings.0.r_studio_package_manager_url", "https://package.domain.com"),
resource.TestCheckResourceAttr(resourceName, "domain_settings.#", "0"),
resource.TestCheckResourceAttr(resourceName, "app_network_access_type", "PublicInternetOnly"),
),
},
{
Config: testAccDomainConfig_rStudioServerProDomainSettingsUpdate(rName, "VpcOnly", "https://connect.domain.com", "https://package.domain.com"),
Config: testAccDomainConfig_rStudioDomainDisabledNetworkUpdate(rName, "VpcOnly"),
Check: resource.ComposeTestCheckFunc(
testAccCheckDomainExists(ctx, resourceName, &domain),
resource.TestCheckResourceAttr(resourceName, "domain_settings.#", "1"),
resource.TestCheckResourceAttr(resourceName, "domain_settings.0.r_studio_server_pro_domain_settings.#", "1"),
resource.TestCheckResourceAttr(resourceName, "domain_settings.0.r_studio_server_pro_domain_settings.0.r_studio_connect_url", "https://connect.domain.com"),
resource.TestCheckResourceAttr(resourceName, "domain_settings.0.r_studio_server_pro_domain_settings.0.r_studio_package_manager_url", "https://package.domain.com"),
),
resource.TestCheckResourceAttr(resourceName, "domain_settings.#", "0"),
resource.TestCheckResourceAttr(resourceName, "app_network_access_type", "VpcOnly")),
},
},
})
@@ -2523,7 +2518,7 @@ resource "aws_sagemaker_domain" "test" {
`, rName, connectURL, packageURL))
}

func testAccDomainConfig_rStudioServerProDomainSettingsUpdate(rName, networkAccess, connectURL, packageURL string) string {
func testAccDomainConfig_rStudioDomainDisabledNetworkUpdate(rName, networkAccess string) string {
return acctest.ConfigCompose(testAccDomainConfig_baseWithLicense(rName), fmt.Sprintf(`
resource "aws_sagemaker_domain" "test" {
domain_name = %[1]q
@@ -2532,36 +2527,15 @@ resource "aws_sagemaker_domain" "test" {
subnet_ids = aws_subnet.test[*].id
app_network_access_type = %[2]q
domain_settings {
r_studio_server_pro_domain_settings {
r_studio_connect_url = %[3]q
r_studio_package_manager_url = %[4]q
domain_execution_role_arn = aws_iam_role.test.arn
default_resource_spec {
instance_type = "system"
}
}
}
default_user_settings {
execution_role = aws_iam_role.test.arn
}
retention_policy {
home_efs_file_system = "Delete"
}
# ignoring default image
# it would be too hard to create the logic to find the default Rstudio image: https://docs.aws.amazon.com/sagemaker/latest/dg/rstudio-version.html
# it changes for every region
lifecycle {
ignore_changes = [
domain_settings[0].r_studio_server_pro_domain_settings[0].default_resource_spec[0]
]
}
}
`, rName, networkAccess, connectURL, packageURL))
`, rName, networkAccess))
}

func testAccDomainConfig_baseWithLicense(rName string) string {
2 changes: 1 addition & 1 deletion internal/service/sagemaker/sagemaker_test.go
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ func TestAccSageMaker_serial(t *testing.T) {
"rSessionAppSettings": testAccDomain_rSessionAppSettings,
"rStudioServerProAppSettings": testAccDomain_rStudioServerProAppSettings,
"rStudioServerProDomainSettings": testAccDomain_rStudioServerProDomainSettings,
"rStudioServerProDomainSettingsUpdate": testAccDomain_rStudioServerProDomainSettingsUpdate,
"rStudioDomainDisabledNetworkUpdate": testAccDomain_rStudioDomainDisabledNetworkUpdate,
"spaceSettingsKernelGatewayAppSettings": testAccDomain_spaceSettingsKernelGatewayAppSettings,
"spaceSettingsJupyterLabAppSettings": testAccDomain_spaceSettingsJupyterLabAppSettings,
"spaceSettingsSpaceStorageSettings": testAccDomain_spaceSettingsSpaceStorageSettings,

0 comments on commit 02f3e41

Please sign in to comment.