Skip to content

Commit

Permalink
#24358: Adding testcase for vm_template
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavmb committed Feb 13, 2024
1 parent 222f70b commit 011433a
Showing 1 changed file with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ func TestAccVirtualDesktopHostPool_basic(t *testing.T) {
})
}

func TestAccVirtualDesktopHostPool_vmTemplate(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_virtual_desktop_host_pool", "test")
r := VirtualDesktopHostPoolResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.vmTemplate(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("vm_template").IsNotEmpty(),
),
},
})
}

func TestAccVirtualDesktopHostPool_agentupdates(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_virtual_desktop_host_pool", "test")
r := VirtualDesktopHostPoolResource{}
Expand Down Expand Up @@ -253,6 +268,46 @@ resource "azurerm_virtual_desktop_host_pool" "test" {
`, data.RandomInteger, data.Locations.Secondary, data.RandomString)
}

func (VirtualDesktopHostPoolResource) vmTemplate(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-vdesktophp-%d"
location = "%s"
}
resource "azurerm_virtual_desktop_host_pool" "test" {
name = "acctestHP%s"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
type = "Pooled"
validate_environment = true
load_balancer_type = "DepthFirst"
vm_template = <<EOF
{
"imageType": "Gallery",
"galleryImageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2019-Datacenter",
"version": "latest"
},
"osDiskType": "Premium_LRS",
"customRdpProperty": {
"audioRedirectionMode": "dynamic",
"redirectClipboard": true,
"redirectDrives": true
}
}
EOF
}
`, data.RandomInteger, data.Locations.Secondary, data.RandomString)
}

func (VirtualDesktopHostPoolResource) complete(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
Expand Down

0 comments on commit 011433a

Please sign in to comment.