Skip to content

Commit

Permalink
Merge pull request #23230 from ms-henglu/branch-230911-update-aks-kub…
Browse files Browse the repository at this point in the history
…ernetes-version

`azurerm_kubernetes_cluster` - update version in test cases
  • Loading branch information
tombuildsstuff authored Sep 11, 2023
2 parents 2c28cd6 + 8b3f266 commit 2e10b8a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -815,26 +815,26 @@ resource "azurerm_kubernetes_cluster" "test" {
`, tenantId, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger)
}

func (KubernetesClusterResource) roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data acceptance.TestData, tenantId string) string {
func (KubernetesClusterResource) roleBasedAccessControlAADManagedConfigOlderKubernetesVersion(data acceptance.TestData, tenantId string) string {
return fmt.Sprintf(`
variable "tenant_id" {
default = "%s"
default = "%[1]s"
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-aks-%d"
location = "%s"
name = "acctestRG-aks-%[3]d"
location = "%[2]s"
}
resource "azurerm_kubernetes_cluster" "test" {
name = "acctestaks%d"
name = "acctestaks%[3]d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
dns_prefix = "acctestaks%d"
kubernetes_version = "1.24.9"
dns_prefix = "acctestaks%[3]d"
kubernetes_version = "%[4]s"
linux_profile {
admin_username = "acctestuser%d"
admin_username = "acctestuser%[3]d"
ssh_key {
key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqaZoyiz1qbdOQ8xEf6uEu1cCwYowo5FHtsBhqLoDnnp7KUTEBN+L2NxRIfQ781rxV6Iq5jSav6b2Q8z5KiseOlvKA/RF2wqU0UPYqQviQhLmW6THTpmrv/YkUCuzxDpsH7DUDhZcwySLKVVe0Qm3+5N2Ta6UYH3lsDf9R9wTP2K/+vAnflKebuypNlmocIvakFWoZda18FOmsOoIVXQ8HWFNCuw9ZCunMSN62QGamCe3dL5cXlkgHYv7ekJE15IA9aOJcM7e90oeTqo+7HTcWfdu0qQqPWY5ujyMw/llas8tsXY85LFqRnr3gJ02bAscjc477+X+j/gkpFoN1QEmt [email protected]"
Expand All @@ -857,7 +857,7 @@ resource "azurerm_kubernetes_cluster" "test" {
azure_rbac_enabled = false
}
}
`, tenantId, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger)
`, tenantId, data.Locations.Primary, data.RandomInteger, olderKubernetesVersion)
}

func (KubernetesClusterResource) roleBasedAccessControlAADManagedConfigWithLocalAccountDisabled(data acceptance.TestData, tenantId string) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ func TestAccDataSourceKubernetesCluster_roleBasedAccessControl(t *testing.T) {
})
}

func TestAccDataSourceKubernetesCluster_roleBasedAccessControlAAD_VOneDotTwoFourDotNine(t *testing.T) {
func TestAccDataSourceKubernetesCluster_roleBasedAccessControlAAD_OlderKubernetesVersion(t *testing.T) {
data := acceptance.BuildTestData(t, "data.azurerm_kubernetes_cluster", "test")
r := KubernetesClusterDataSource{}

data.DataSourceTest(t, []acceptance.TestStep{
{
Config: r.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data),
Config: r.roleBasedAccessControlAADManagedConfigOlderKubernetesVersion(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("kube_config.#").HasValue("1"),
check.That(data.ResourceName).Key("kube_config.0.host").IsSet(),
Expand Down Expand Up @@ -613,15 +613,15 @@ data "azurerm_kubernetes_cluster" "test" {
`, KubernetesClusterResource{}.roleBasedAccessControlConfig(data))
}

func (KubernetesClusterDataSource) roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data acceptance.TestData) string {
func (KubernetesClusterDataSource) roleBasedAccessControlAADManagedConfigOlderKubernetesVersion(data acceptance.TestData) string {
return fmt.Sprintf(`
%s
data "azurerm_kubernetes_cluster" "test" {
name = azurerm_kubernetes_cluster.test.name
resource_group_name = azurerm_kubernetes_cluster.test.resource_group_name
}
`, KubernetesClusterResource{}.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data, ""))
`, KubernetesClusterResource{}.roleBasedAccessControlAADManagedConfigOlderKubernetesVersion(data, ""))
}

func (KubernetesClusterDataSource) localAccountDisabled(data acceptance.TestData, tenantId string) string {
Expand Down
12 changes: 6 additions & 6 deletions internal/services/containers/kubernetes_cluster_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
type KubernetesClusterResource struct{}

var (
olderKubernetesVersion = "1.24.9"
currentKubernetesVersion = "1.25.5"
olderKubernetesVersionAlias = "1.24"
currentKubernetesVersionAlias = "1.25"
olderKubernetesVersion = "1.25.11"
currentKubernetesVersion = "1.26.6"
olderKubernetesVersionAlias = "1.25"
currentKubernetesVersionAlias = "1.26"
)

func TestAccKubernetesCluster_hostEncryption(t *testing.T) {
Expand Down Expand Up @@ -538,13 +538,13 @@ resource "azurerm_kubernetes_cluster" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, maxSurge)
}

func TestAccResourceKubernetesCluster_roleBasedAccessControlAAD_VOneDotTwoFourDotNine(t *testing.T) {
func TestAccResourceKubernetesCluster_roleBasedAccessControlAAD_OlderKubernetesVersion(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test")
r := KubernetesClusterResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.roleBasedAccessControlAADManagedConfigVOneDotTwoFourDotNine(data, ""),
Config: r.roleBasedAccessControlAADManagedConfigOlderKubernetesVersion(data, ""),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("kube_config.#").HasValue("1"),
check.That(data.ResourceName).Key("kube_config.0.host").IsSet(),
Expand Down

0 comments on commit 2e10b8a

Please sign in to comment.