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

test(workspace/app): using server group resource to instead corresponding env #6109

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions huaweicloud/services/acceptance/acceptance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1543,13 +1543,6 @@ func TestAccPreCheckWorkspaceInternetAccessPort(t *testing.T) {
}
}

// lintignore:AT003
func TestAccPreCheckWorkspaceAppServerGroupId(t *testing.T) {
if HW_WORKSPACE_APP_SERVER_GROUP_ID == "" {
t.Skip("HW_WORKSPACE_APP_SERVER_GROUP_ID must be set for Workspace service acceptance tests.")
}
}

// lintignore:AT003
func TestAccPreCheckWorkspaceAppServerGroup(t *testing.T) {
if HW_WORKSPACE_AD_VPC_ID == "" || HW_WORKSPACE_AD_NETWORK_ID == "" ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud/services/acceptance"
)

func TestAccDataSourceWorkspaceAppGroups_basic(t *testing.T) {
func TestAccDataSourceAppGroups_basic(t *testing.T) {
var (
rName = acceptance.RandomAccResourceName()
dataSource = "data.huaweicloud_workspace_app_groups.test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestAccResourceAppGroupAuthorization_expectErr(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
acceptance.TestAccPreCheck(t)
acceptance.TestAccPreCheckWorkspaceAppServerGroupId(t)
acceptance.TestAccPreCheckWorkspaceAppServerGroup(t)
},
ProviderFactories: acceptance.TestAccProviderFactories,
CheckDestroy: nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func getResourceWorkspaceAppGroupFunc(cfg *config.Config, state *terraform.Resou
return resp, err
}

func TestAccResourceWorkspaceAppGroup_basic(t *testing.T) {
func TestAccResourceAppGroup_basic(t *testing.T) {
var (
resourceName = "huaweicloud_workspace_app_group.test"
name = acceptance.RandomAccResourceName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAccAppPolicyGroup_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
acceptance.TestAccPreCheck(t)
acceptance.TestAccPreCheckWorkspaceAppServerGroupId(t)
acceptance.TestAccPreCheckWorkspaceAppServerGroup(t)
},
ProviderFactories: acceptance.TestAccProviderFactories,
CheckDestroy: rc.CheckResourceDestroy(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAccAppPublishment_basic(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() {
acceptance.TestAccPreCheck(t)
acceptance.TestAccPreCheckWorkspaceAppServerGroupId(t)
acceptance.TestAccPreCheckWorkspaceAppServerGroup(t)
},
ProviderFactories: acceptance.TestAccProviderFactories,
CheckDestroy: rc.CheckResourceDestroy(),
Expand Down Expand Up @@ -90,6 +90,33 @@ func TestAccAppPublishment_basic(t *testing.T) {
})
}

func testAccAppPublishment_base(name string) string {
return fmt.Sprintf(`
resource "huaweicloud_workspace_app_group" "test" {
name = "%[1]s"
}

resource "huaweicloud_workspace_app_server_group" "test" {
name = "%[1]s"
os_type = "Windows"
flavor_id = "%[2]s"
vpc_id = "%[3]s"
subnet_id = "%[4]s"
system_disk_type = "SAS"
system_disk_size = 80
is_vdi = true
app_type = "COMMON_APP"
image_id = "%[5]s"
image_type = "gold"
image_product_id = "%[6]s"
}
`, name, acceptance.HW_WORKSPACE_APP_SERVER_GROUP_FLAVOR_ID,
acceptance.HW_WORKSPACE_AD_VPC_ID,
acceptance.HW_WORKSPACE_AD_NETWORK_ID,
acceptance.HW_WORKSPACE_APP_SERVER_GROUP_IMAGE_ID,
acceptance.HW_WORKSPACE_APP_SERVER_GROUP_IMAGE_PRODUCT_ID)
}

func testAccAppPublishment_basic_step1(name string) string {
return fmt.Sprintf(`
%[1]s
Expand All @@ -109,7 +136,7 @@ resource "huaweicloud_workspace_app_publishment" "test" {
icon_index = 0
status = "FORBIDDEN"
}
`, testResourceWorkspaceAppGroup_basic_step1(name), name)
`, testAccAppPublishment_base(name), name)
}

func testAccAppPublishment_basic_step2(updateName string) string {
Expand All @@ -127,7 +154,7 @@ resource "huaweicloud_workspace_app_publishment" "test" {
icon_index = 0
status = "NORMAL"
}
`, testResourceWorkspaceAppGroup_basic_step1(updateName), updateName)
`, testAccAppPublishment_base(updateName), updateName)
}

func testAppPublishmentImportState(rName string) resource.ImportStateIdFunc {
Expand Down
Loading