Skip to content

Commit

Permalink
Add identity validation to testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Jul 27, 2021
1 parent b4720c5 commit 8ff869a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/k8s-extension/azext_k8s_extension/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def create_k8s_extension(cmd, client, resource_group_name, cluster_name, name, c
extension_instance.identity, extension_instance.location = \
__create_identity(cmd, resource_group_name, cluster_name, cluster_type, cluster_rp)

print(extension_instance)
# Try to create the resource
return client.create(resource_group_name, cluster_rp, cluster_type, cluster_name, name, extension_instance)

Expand Down Expand Up @@ -235,7 +234,6 @@ def __create_identity(cmd, resource_group_name, cluster_name, cluster_type, clus

try:
resource = resources.get_by_id(cluster_resource_id, parent_api_version)
print(resource)
location = str(resource.location.lower())
except HttpResponseError as ex:
raise ex
Expand Down
4 changes: 3 additions & 1 deletion testing/test/extensions/public/AzureMonitor.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ Describe 'Azure Monitor Testing' {
do
{
if (Has-ExtensionData $extensionName) {
break
if (Has-Identity-Provisioned) {
break
}
}
Start-Sleep -Seconds 10
$n += 1
Expand Down
6 changes: 6 additions & 0 deletions testing/test/helper/Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ function Has-ExtensionData {
return $false
}


function Has-Identity-Provisioned {
$output = kubectl get azureclusteridentityrequests -n azure-arc container-insights-clusteridentityrequest -o json | ConvertFrom-Json
return ($null -ne $output.status.expirationTime) -and ($null -ne $output.status.tokenReference.dataName) -and ($null -ne $output.status.tokenReference.secretName)
}

function Get-ExtensionStatus {
param(
[string]$extensionName
Expand Down

0 comments on commit 8ff869a

Please sign in to comment.