From 22217456d5a466c6f60dea65588f980272d469ab Mon Sep 17 00:00:00 2001 From: Jinpei Li Date: Mon, 13 May 2024 10:31:39 +0800 Subject: [PATCH] Fix issue for KubernetesConfigutation --- .../README.md | 3 -- .../custom/New-AzKubernetesExtension.ps1 | 13 --------- ...t-AzKubernetesConfigFluxOperationStatus.md | 17 ----------- .../docs/Get-AzKubernetesConfiguration.md | 17 ----------- .../docs/Get-AzKubernetesConfigurationFlux.md | 17 ----------- .../docs/Get-AzKubernetesExtension.md | 17 ----------- .../docs/Remove-AzKubernetesConfiguration.md | 17 ----------- .../Remove-AzKubernetesConfigurationFlux.md | 17 ----------- .../docs/Remove-AzKubernetesExtension.md | 17 ----------- .../Update-AzKubernetesConfigurationFlux.md | 17 ----------- .../docs/Update-AzKubernetesExtension.md | 17 ----------- ...ernetesConfigFluxOperationStatus.Tests.ps1 | 25 ++++++++++++++++ .../Get-AzKubernetesConfiguration.Tests.ps1 | 29 +++++++++++++++++++ ...et-AzKubernetesConfigurationFlux.Tests.ps1 | 29 +++++++++++++++++++ .../test/Get-AzKubernetesExtension.Tests.ps1 | 29 +++++++++++++++++++ .../New-AzKubernetesConfiguration.Tests.ps1 | 21 ++++++++++++++ ...ew-AzKubernetesConfigurationFlux.Tests.ps1 | 21 ++++++++++++++ .../test/New-AzKubernetesExtension.Tests.ps1 | 21 ++++++++++++++ ...Remove-AzKubernetesConfiguration.Tests.ps1 | 25 ++++++++++++++++ ...ve-AzKubernetesConfigurationFlux.Tests.ps1 | 25 ++++++++++++++++ .../Remove-AzKubernetesExtension.Tests.ps1 | 25 ++++++++++++++++ ...te-AzKubernetesConfigurationFlux.Tests.ps1 | 25 ++++++++++++++++ .../Update-AzKubernetesExtension.Tests.ps1 | 25 ++++++++++++++++ .../test/loadEnv.ps1 | 2 +- .../test/utils.ps1 | 2 +- .../utils/Get-SubscriptionIdTestSafe.ps1 | 7 +++++ 26 files changed, 309 insertions(+), 171 deletions(-) create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfigFluxOperationStatus.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfiguration.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfigurationFlux.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesExtension.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesConfiguration.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesConfigurationFlux.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesExtension.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesConfiguration.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesConfigurationFlux.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesExtension.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Update-AzKubernetesConfigurationFlux.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Update-AzKubernetesExtension.Tests.ps1 create mode 100644 src/KubernetesConfiguration/KubernetesConfiguration.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/README.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/README.md index f557a3e8e5ad..a627675ff109 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/README.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/README.md @@ -3,9 +3,6 @@ This directory contains the PowerShell module for the KubernetesConfiguration service. --- -## Status -[![Az.KubernetesConfiguration](https://img.shields.io/powershellgallery/v/Az.KubernetesConfiguration.svg?style=flat-square&label=Az.KubernetesConfiguration "Az.KubernetesConfiguration")](https://www.powershellgallery.com/packages/Az.KubernetesConfiguration/) - ## Info - Modifiable: yes - Generated: all diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/custom/New-AzKubernetesExtension.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/custom/New-AzKubernetesExtension.ps1 index fb859b37895a..9ed3f273cfd1 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/custom/New-AzKubernetesExtension.ps1 +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/custom/New-AzKubernetesExtension.ps1 @@ -249,19 +249,6 @@ function New-AzKubernetesExtension { Write-Error "Please select ClusterType from the following three values: 'ManagedClusters', 'ConnectedClusters', 'ProvisionedClusters'" } - if ($Name -ieq 'flux') { - if ($Name -ceq 'flux') { - if ($IdentityType -cne 'SystemAssigned') { - Write-Error "The value of the parameter -IdentityType must be 'SystemAssigned'." - return - } - } - else { - Write-Error "The value of the parameter -Name must be 'flux'." - return - } - } - write-host "Azure Kubernetes Configuration Extension is being created, need to wait a few minutes..." Az.KubernetesConfiguration.internal\New-AzKubernetesExtension @PSBoundParameters } diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfigFluxOperationStatus.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfigFluxOperationStatus.md index c92462de8483..ab6a005b12da 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfigFluxOperationStatus.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfigFluxOperationStatus.md @@ -186,22 +186,5 @@ ALIASES Get-AzK8sConfigFluxOperationStatus -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfiguration.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfiguration.md index 4e7b47e9342e..8ef90b77c22e 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfiguration.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfiguration.md @@ -190,22 +190,5 @@ ALIASES Get-AzK8sConfiguration -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfigurationFlux.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfigurationFlux.md index b03e4d962ecd..2b44e26f7a43 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfigurationFlux.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesConfigurationFlux.md @@ -189,22 +189,5 @@ ALIASES Get-AzK8sConfigurationFlux -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesExtension.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesExtension.md index 124764e808da..65bd61a05c25 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesExtension.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Get-AzKubernetesExtension.md @@ -190,22 +190,5 @@ ALIASES Get-AzK8sExtension -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesConfiguration.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesConfiguration.md index d7b0d4de42b5..5430586e2a4e 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesConfiguration.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesConfiguration.md @@ -248,22 +248,5 @@ ALIASES Remove-AzK8sConfiguration -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesConfigurationFlux.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesConfigurationFlux.md index 7e2f4be195fd..93f53ecf9585 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesConfigurationFlux.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesConfigurationFlux.md @@ -263,22 +263,5 @@ ALIASES Remove-AzK8sConfigurationFlux -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesExtension.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesExtension.md index df8af4567bb3..c3bdc54ef345 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesExtension.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Remove-AzKubernetesExtension.md @@ -258,22 +258,5 @@ ALIASES Remove-AzK8sExtension -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Update-AzKubernetesConfigurationFlux.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Update-AzKubernetesConfigurationFlux.md index 0f3b0bd12c9b..c95c660df5b4 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Update-AzKubernetesConfigurationFlux.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Update-AzKubernetesConfigurationFlux.md @@ -815,22 +815,5 @@ ALIASES Update-AzK8sConfigurationFlux -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Update-AzKubernetesExtension.md b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Update-AzKubernetesExtension.md index 191eeac1d390..8646102c9560 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Update-AzKubernetesExtension.md +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/docs/Update-AzKubernetesExtension.md @@ -311,22 +311,5 @@ ALIASES Update-AzK8sExtension -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -`INPUTOBJECT `: Identity Parameter - - `[ClusterName ]`: The name of the kubernetes cluster. - - `[ClusterResourceName ]`: The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, provisionedClusters. - - `[ClusterRp ]`: The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, Microsoft.HybridContainerService. - - `[ExtensionName ]`: Name of the Extension. - - `[FluxConfigurationName ]`: Name of the Flux Configuration. - - `[Id ]`: Resource identity path - - `[OperationId ]`: operation Id - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[SourceControlConfigurationName ]`: Name of the Source Control Configuration. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfigFluxOperationStatus.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfigFluxOperationStatus.Tests.ps1 new file mode 100644 index 000000000000..53563ce1557a --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfigFluxOperationStatus.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzKubernetesConfigFluxOperationStatus')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzKubernetesConfigFluxOperationStatus.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzKubernetesConfigFluxOperationStatus' { + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfiguration.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfiguration.Tests.ps1 new file mode 100644 index 000000000000..cb58c2c8f51a --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfiguration.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzKubernetesConfiguration')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzKubernetesConfiguration.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzKubernetesConfiguration' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfigurationFlux.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfigurationFlux.Tests.ps1 new file mode 100644 index 000000000000..f03ae240dcfd --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesConfigurationFlux.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzKubernetesConfigurationFlux')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzKubernetesConfigurationFlux.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzKubernetesConfigurationFlux' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesExtension.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesExtension.Tests.ps1 new file mode 100644 index 000000000000..4161dfc7c918 --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Get-AzKubernetesExtension.Tests.ps1 @@ -0,0 +1,29 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Get-AzKubernetesExtension')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzKubernetesExtension.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Get-AzKubernetesExtension' { + It 'List' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Get' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'GetViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesConfiguration.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesConfiguration.Tests.ps1 new file mode 100644 index 000000000000..92751411ea32 --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesConfiguration.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzKubernetesConfiguration')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzKubernetesConfiguration.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzKubernetesConfiguration' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesConfigurationFlux.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesConfigurationFlux.Tests.ps1 new file mode 100644 index 000000000000..d32af3545955 --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesConfigurationFlux.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzKubernetesConfigurationFlux')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzKubernetesConfigurationFlux.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzKubernetesConfigurationFlux' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesExtension.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesExtension.Tests.ps1 new file mode 100644 index 000000000000..c760f6889605 --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/New-AzKubernetesExtension.Tests.ps1 @@ -0,0 +1,21 @@ +if(($null -eq $TestName) -or ($TestName -contains 'New-AzKubernetesExtension')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'New-AzKubernetesExtension.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'New-AzKubernetesExtension' { + It 'CreateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesConfiguration.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesConfiguration.Tests.ps1 new file mode 100644 index 000000000000..bf21ac334aca --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesConfiguration.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzKubernetesConfiguration')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzKubernetesConfiguration.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzKubernetesConfiguration' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesConfigurationFlux.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesConfigurationFlux.Tests.ps1 new file mode 100644 index 000000000000..d9131a30934b --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesConfigurationFlux.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzKubernetesConfigurationFlux')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzKubernetesConfigurationFlux.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzKubernetesConfigurationFlux' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesExtension.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesExtension.Tests.ps1 new file mode 100644 index 000000000000..2e460138e068 --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Remove-AzKubernetesExtension.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Remove-AzKubernetesExtension')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzKubernetesExtension.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Remove-AzKubernetesExtension' { + It 'Delete' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'DeleteViaIdentity' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Update-AzKubernetesConfigurationFlux.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Update-AzKubernetesConfigurationFlux.Tests.ps1 new file mode 100644 index 000000000000..70669eaa763c --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Update-AzKubernetesConfigurationFlux.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzKubernetesConfigurationFlux')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzKubernetesConfigurationFlux.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzKubernetesConfigurationFlux' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Update-AzKubernetesExtension.Tests.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Update-AzKubernetesExtension.Tests.ps1 new file mode 100644 index 000000000000..3912b7593934 --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/Update-AzKubernetesExtension.Tests.ps1 @@ -0,0 +1,25 @@ +if(($null -eq $TestName) -or ($TestName -contains 'Update-AzKubernetesExtension')) +{ + $loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' + if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' + } + . ($loadEnvPath) + $TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzKubernetesExtension.Recording.json' + $currentPath = $PSScriptRoot + while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent + } + . ($mockingPath | Select-Object -First 1).FullName +} + +Describe 'Update-AzKubernetesExtension' { + It 'UpdateExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/loadEnv.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/loadEnv.ps1 index 5f079e89615e..6a7c385c6b7d 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/loadEnv.ps1 +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/loadEnv.ps1 @@ -25,5 +25,5 @@ if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { $env = @{} if (Test-Path -Path $envFilePath) { $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json - $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} + $PSDefaultParameterValues=@{"*:Tenant"=$env.Tenant} } \ No newline at end of file diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/utils.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/utils.ps1 index 05b7f7208bbb..c57e40daf6aa 100644 --- a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/utils.ps1 +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/test/utils.ps1 @@ -77,7 +77,7 @@ function setupEnv() { New-AzResourceGroup -Name $env.resourceGroup -Location $env.location write-host "2. az aks create..." - az aks create --name $env.k8sName1 --resource-group $env.resourceGroup --kubernetes-version 1.25.5 --vm-set-type AvailabilitySet + az aks create --name $env.k8sName1 --resource-group $env.resourceGroup --kubernetes-version 1.29.2 --vm-set-type AvailabilitySet write-host "3. az aks get-credentials..." az aks get-credentials --name $env.k8sName1 --resource-group $env.resourceGroup diff --git a/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 new file mode 100644 index 000000000000..5319862d3372 --- /dev/null +++ b/src/KubernetesConfiguration/KubernetesConfiguration.Autorest/utils/Get-SubscriptionIdTestSafe.ps1 @@ -0,0 +1,7 @@ +param() +if ($env:AzPSAutorestTestPlaybackMode) { + $loadEnvPath = Join-Path $PSScriptRoot '..' 'test' 'loadEnv.ps1' + . ($loadEnvPath) + return $env.SubscriptionId +} +return (Get-AzContext).Subscription.Id \ No newline at end of file