From 6108814d5a443dc2731a218efc19bfc56a534551 Mon Sep 17 00:00:00 2001 From: Nanxiang Liu Date: Wed, 22 Feb 2023 12:36:42 +0800 Subject: [PATCH 1/9] add live test --- id_rsa | 39 ++++++++++++ id_rsa.pub | 1 + .../LiveTests/TestLiveScenarios.ps1 | 61 +++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 id_rsa create mode 100644 id_rsa.pub create mode 100644 src/ConnectedKubernetes/LiveTests/TestLiveScenarios.ps1 diff --git a/id_rsa b/id_rsa new file mode 100644 index 000000000000..43a397478fda --- /dev/null +++ b/id_rsa @@ -0,0 +1,39 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +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 +-----END OPENSSH PRIVATE KEY----- diff --git a/id_rsa.pub b/id_rsa.pub new file mode 100644 index 000000000000..95545184dc7c --- /dev/null +++ b/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCvmu96bnRu4Cd2Lce2c+fRu43Uizx+OIZNCivwgAtLcd8cCXh0f8uolVTqoG0uexUdUuD8eCKCNxYx0SOqrkEPxVAUDJSj+InU6xL4SCPtzY0HsgkbzL5oY0Nmh0UgCMqJIdlhkBiuaKA+WMrPo02lzdZbEpSA3OxhE82tDInV67H1NvCgpejM4z6b0xPa8+T3RpHkAtOo62QqK3FdmUb5dZZeAdkM/OaGL13t6l8Nr6Ab7/+ppIi/0UzPLCV5gun6rt+NGNjDlyerMji8u1CFsLnzphaWQ0mq6ikzLhoPv3mMDaKBu+P1rAiJVNFv+5nIDjNGTl7sDRn3Jo9D4g3BKsDtTZGHxy4vuaNWmTzeEkJvQzZguyQB+OgWWDWZsuUp5iGK34h6ZaMAQ8DwPIZsnq46/J+66nU+/tRPxYnRajl/hflOgdypj4iLR/bcG2XC0MjfzzgYggsv4NS02wpOHxZUn/vFXYOv8ThjMj3d4mHgeanMewdUZUBXHFImQpM= redmond\nanxiangliu@DESKTOP-E7NG40Q diff --git a/src/ConnectedKubernetes/LiveTests/TestLiveScenarios.ps1 b/src/ConnectedKubernetes/LiveTests/TestLiveScenarios.ps1 new file mode 100644 index 000000000000..89e48566b5da --- /dev/null +++ b/src/ConnectedKubernetes/LiveTests/TestLiveScenarios.ps1 @@ -0,0 +1,61 @@ +Invoke-LiveTestScenario -Name "Create ConnectedKubernetes" -Description "Test New-AzConnectedKubernetes" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $ckName = New-LiveTestResourceName + $ckLocation = "westus" + $actual = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation + Assert-AreEqual $ckName $actual.Name + Assert-AreEqual $ckLocation $actual.Location +} + +Invoke-LiveTestScenario -Name "List ConnectedKubernetes" -Description "Test listing ConnectedKubernetes" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + $ckName = New-LiveTestResourceName + $ckLocation = "westus" + $null = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation + $actual = Get-AzConnectedKubernetes -ResourceGroupName $rgName + Assert-AreEqual 1 $actual.Count +} + +Invoke-LiveTestScenario -Name "Get ConnectedKubernetes" -Description "Test getting one ConnectedKubernetes" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + $ckName = New-LiveTestResourceName + $ckLocation = "westus" + $null = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation + $actual = Get-AzConnectedKubernetes -ResourceGroupName $rgName -ClusterName $ckName + Assert-AreEqual $ckName $actual.Name +} + +Invoke-LiveTestScenario -Name "Update ConnectedKubernetes" -Description "Test Updating one specific ConnectedKubernetes" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + $ckName = New-LiveTestResourceName + $ckLocation = "westus" + $tag = @{'key'='1'} + $null = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation + $null = Update-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Tag $tag + $actual = Get-AzConnectedKubernetes -ResourceGroupName $rgName -ClusterName $ckName + Assert-AreEqual $actual.$tag["key"] "1" +} + +Invoke-LiveTestScenario -Name "Remove ConnectedKubernetes" -Description "Test Removing ConnectedKubernetes" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + $ckName = New-LiveTestResourceName + $ckLocation = "westus" + $actual = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation + Remove-AzConnectedKubernetes -ResourceGroupName $rgName -Name $ckName + $GetServiceList = Get-AzConnectedKubernetes -ResourceGroupName $rgName + Assert-False { $GetServiceList.Name -contains $rgName} +} \ No newline at end of file From 3d4b1dddad632b087b135ba306823510cfabbe75 Mon Sep 17 00:00:00 2001 From: Nanxiang Liu Date: Fri, 24 Feb 2023 01:01:28 +0800 Subject: [PATCH 2/9] add live test for app and ContainerInstance --- src/App/Livetests/TestLiveScenarios.ps1 | 111 ++++++++++++++++++ .../LiveTests/TestLiveScenarios.ps1 | 69 +++++++++++ 2 files changed, 180 insertions(+) create mode 100644 src/App/Livetests/TestLiveScenarios.ps1 create mode 100644 src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 diff --git a/src/App/Livetests/TestLiveScenarios.ps1 b/src/App/Livetests/TestLiveScenarios.ps1 new file mode 100644 index 000000000000..11c653237ddb --- /dev/null +++ b/src/App/Livetests/TestLiveScenarios.ps1 @@ -0,0 +1,111 @@ +Invoke-LiveTestScenario -Name "Create ContainerApp" -Description "Test New-AzContainerApp" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $appName = New-LiveTestResourceName + $appLocation = "westus" + New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId + $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey + New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 + $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" + $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome + $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader + $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi + $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id + $scaleRule = @() + New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule + Assert-AreEqual $appName $actual.Name + Assert-AreEqual $appLocation $actual.Location +} + +Invoke-LiveTestScenario -Name "List ContainerApp" -Description "Test listing ContainerApp" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $appName = New-LiveTestResourceName + $appLocation = "westus" + New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId + $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey + New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 + $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" + $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome + $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader + $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi + $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id + $scaleRule = @() + $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule + $actual = Get-AzContainerApp -ResourceGroupName $rgName + Assert-AreEqual 1 $actual.Count +} + +Invoke-LiveTestScenario -Name "Get ContainerApp" -Description "Test getting one ContainerApp" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $appName = New-LiveTestResourceName + $appLocation = "westus" + New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId + $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey + New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 + $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" + $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome + $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader + $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi + $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id + $scaleRule = @() + $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule + $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName + Assert-AreEqual $appName $actual.Name +} + +Invoke-LiveTestScenario -Name "Update ContainerApp" -Description "Test Updating one specific ContainerApp" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $appName = New-LiveTestResourceName + $appLocation = "westus" + New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId + $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey + New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 + $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" + $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome + $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader + $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi + $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id + $scaleRule = @() + $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule + $null = Update-AzContainerApp -Name $appName -ResourceGroupName $rgName -DaprAppPort 8888 -Location $appLocation + $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName + Assert-AreEqual $actual.$DaprAppPort 8888 +} + +Invoke-LiveTestScenario -Name "Remove ContainerApp" -Description "Test Removing ContainerApp" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $appName = New-LiveTestResourceName + $appLocation = "westus" + New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId + $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey + New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 + $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" + $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome + $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader + $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi + $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id + $scaleRule = @() + $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule + $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName + $GetServiceList = Get-AzContainerApp -ResourceGroupName $rgName + Assert-False { $GetServiceList.Name -contains $appName} +} \ No newline at end of file diff --git a/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 b/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 new file mode 100644 index 000000000000..d3ad5ea17953 --- /dev/null +++ b/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 @@ -0,0 +1,69 @@ +Invoke-LiveTestScenario -Name "Create ContainerGroup" -Description "Test New-AzContainerGroup" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $containerName = New-LiveTestResourceName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $container = New-AzContainerInstanceObject -Name $containerName -Image alpine + $actual = New-AzContainerGroup -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Container $container + Assert-AreEqual $cgName $actual.Name + Assert-AreEqual $cgLocation $actual.Location +} + +Invoke-LiveTestScenario -Name "List ContainerGroup" -Description "Test listing ContainerGroup" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + $containerName = New-LiveTestResourceName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $container = New-AzContainerInstanceObject -Name $containerName -Image alpine + $null = New-AzContainerGroup -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Container $container + $actual = Get-AzContainerGroup -ResourceGroupName $rgName + Assert-AreEqual 1 $actual.Count +} + +Invoke-LiveTestScenario -Name "Get ContainerGroup" -Description "Test getting one ContainerGroup" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + $containerName = New-LiveTestResourceName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $container = New-AzContainerInstanceObject -Name $containerName -Image alpine + $null = New-AzContainerGroup -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Container $container + $actual = Get-AzContainerGroup -ResourceGroupName $rgName -Name $cgName + Assert-AreEqual $cgName $actual.Name +} + +Invoke-LiveTestScenario -Name "Update ContainerGroup" -Description "Test Updating one specific ContainerGroup" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + $containerName = New-LiveTestResourceName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $tag = @{'key'='v'} + $container = New-AzContainerInstanceObject -Name $containerName -Image alpine + $null = New-AzContainerGroup -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Container $container + $null = Update-AzContainerGroup -Name $cgName -ResourceGroupName $rgName -Tag $tag + $actual = Get-AzContainerGroup -ResourceGroupName $rgName -Name $cgName + Assert-AreEqual $actual.$tag.Count 1 +} + +Invoke-LiveTestScenario -Name "Remove ContainerGroup" -Description "Test Removing ContainerGroup" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $containerName = New-LiveTestResourceName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $container = New-AzContainerInstanceObject -Name $containerName -Image alpine + $null = New-AzContainerGroup -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Container $container + $GetServiceList = Get-AzContainerGroup -ResourceGroupName $rgName + Assert-False { $GetServiceList.Name -contains $cgName} +} \ No newline at end of file From 6fd1ceb3d6510e06734fc999c89c343887783b86 Mon Sep 17 00:00:00 2001 From: Nanxiang Liu Date: Fri, 24 Feb 2023 10:48:19 +0800 Subject: [PATCH 3/9] revise test --- src/App/Livetests/TestLiveScenarios.ps1 | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/App/Livetests/TestLiveScenarios.ps1 b/src/App/Livetests/TestLiveScenarios.ps1 index 11c653237ddb..1e54350bcf2c 100644 --- a/src/App/Livetests/TestLiveScenarios.ps1 +++ b/src/App/Livetests/TestLiveScenarios.ps1 @@ -1,13 +1,13 @@ -Invoke-LiveTestScenario -Name "Create ContainerApp" -Description "Test New-AzContainerApp" -ScenarioScript ` +Invoke-LiveTestScenario -Name "Create ContainerApp" -Description "Test create AzContainerApp" -ScenarioScript ` { param ($rg) $rgName = $rg.ResourceGroupName $appName = New-LiveTestResourceName $appLocation = "westus" - New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome @@ -15,7 +15,7 @@ Invoke-LiveTestScenario -Name "Create ContainerApp" -Description "Test New-AzCon $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id $scaleRule = @() - New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule + $actual = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule Assert-AreEqual $appName $actual.Name Assert-AreEqual $appLocation $actual.Location } @@ -26,10 +26,10 @@ Invoke-LiveTestScenario -Name "List ContainerApp" -Description "Test listing Con $rgName = $rg.ResourceGroupName $appName = New-LiveTestResourceName $appLocation = "westus" - New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome @@ -48,10 +48,10 @@ Invoke-LiveTestScenario -Name "Get ContainerApp" -Description "Test getting one $rgName = $rg.ResourceGroupName $appName = New-LiveTestResourceName $appLocation = "westus" - New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome @@ -70,10 +70,10 @@ Invoke-LiveTestScenario -Name "Update ContainerApp" -Description "Test Updating $rgName = $rg.ResourceGroupName $appName = New-LiveTestResourceName $appLocation = "westus" - New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome @@ -93,10 +93,10 @@ Invoke-LiveTestScenario -Name "Remove ContainerApp" -Description "Test Removing $rgName = $rg.ResourceGroupName $appName = New-LiveTestResourceName $appLocation = "westus" - New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome @@ -104,7 +104,7 @@ Invoke-LiveTestScenario -Name "Remove ContainerApp" -Description "Test Removing $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id $scaleRule = @() - $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule + $null = Remove-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName $GetServiceList = Get-AzContainerApp -ResourceGroupName $rgName Assert-False { $GetServiceList.Name -contains $appName} From 4acc963f85d3883c35538e0345d2c1b110573ee3 Mon Sep 17 00:00:00 2001 From: Nanxiang Liu Date: Fri, 24 Feb 2023 17:54:35 +0800 Subject: [PATCH 4/9] add live test --- src/App/Livetests/TestLiveScenarios.ps1 | 8 +-- .../LiveTests/TestLiveScenarios.ps1 | 1 + .../LiveTests/TestLiveScenarios.ps1 | 60 +++++++++++++++++++ 3 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 diff --git a/src/App/Livetests/TestLiveScenarios.ps1 b/src/App/Livetests/TestLiveScenarios.ps1 index 1e54350bcf2c..30bfc6778bf3 100644 --- a/src/App/Livetests/TestLiveScenarios.ps1 +++ b/src/App/Livetests/TestLiveScenarios.ps1 @@ -17,7 +17,7 @@ Invoke-LiveTestScenario -Name "Create ContainerApp" -Description "Test create Az $scaleRule = @() $actual = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule Assert-AreEqual $appName $actual.Name - Assert-AreEqual $appLocation $actual.Location + Assert-AreEqual 8080 $actual.DaprAppPort } Invoke-LiveTestScenario -Name "List ContainerApp" -Description "Test listing ContainerApp" -ScenarioScript ` @@ -84,7 +84,7 @@ Invoke-LiveTestScenario -Name "Update ContainerApp" -Description "Test Updating $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule $null = Update-AzContainerApp -Name $appName -ResourceGroupName $rgName -DaprAppPort 8888 -Location $appLocation $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName - Assert-AreEqual $actual.$DaprAppPort 8888 + Assert-AreEqual $actual.DaprAppPort 8888 } Invoke-LiveTestScenario -Name "Remove ContainerApp" -Description "Test Removing ContainerApp" -ScenarioScript ` @@ -104,8 +104,8 @@ Invoke-LiveTestScenario -Name "Remove ContainerApp" -Description "Test Removing $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id $scaleRule = @() - $null = Remove-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule - $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName + $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule + $null = Remove-AzContainerApp -ResourceGroupName $rgName -Name $appName $GetServiceList = Get-AzContainerApp -ResourceGroupName $rgName Assert-False { $GetServiceList.Name -contains $appName} } \ No newline at end of file diff --git a/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 b/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 index d3ad5ea17953..5edb67db1d99 100644 --- a/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 +++ b/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 @@ -64,6 +64,7 @@ Invoke-LiveTestScenario -Name "Remove ContainerGroup" -Description "Test Removin $cgLocation = "westus" $container = New-AzContainerInstanceObject -Name $containerName -Image alpine $null = New-AzContainerGroup -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Container $container + $null = Remove-AzContainerGroup -ResourceGroupName $rgName -Name $cgName $GetServiceList = Get-AzContainerGroup -ResourceGroupName $rgName Assert-False { $GetServiceList.Name -contains $cgName} } \ No newline at end of file diff --git a/src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 b/src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 new file mode 100644 index 000000000000..f9fdc255d5ac --- /dev/null +++ b/src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 @@ -0,0 +1,60 @@ +Invoke-LiveTestScenario -Name "Create ContainerRegistry" -Description "Test Create AzContainerRegistry" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $actual = New-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Sku Basic + Assert-AreEqual $cgName $actual.Name + Assert-AreEqual $cgLocation $actual.Location +} + +Invoke-LiveTestScenario -Name "List ContainerRegistry" -Description "Test listing ContainerRegistry" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $null = New-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Sku Basic + $actual = Get-AzContainerRegistry -ResourceGroupName $rgName + Assert-AreEqual 1 $actual.Count +} + +Invoke-LiveTestScenario -Name "Get ContainerRegistry" -Description "Test getting one ContainerRegistry" -ScenarioScript ` +{ + param ($rg) + + $rgName = $rg.ResourceGroupName + + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + + $null = New-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Sku Basic + $actual = Get-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName + Assert-AreEqual $cgName $actual.Name +} + +Invoke-LiveTestScenario -Name "Update ContainerRegistry" -Description "Test Updating one specific ContainerRegistry" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $null = New-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Sku Basic + $null = Update-AzContainerRegistry -Name $cgName -ResourceGroupName $rgName -EnableAdminUser + $actual = Get-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName + Assert-AreEqual $actual.AdminUserEnabled True +} + +Invoke-LiveTestScenario -Name "Remove ContainerRegistry" -Description "Test Removing ContainerRegistry" -ScenarioScript ` +{ + param ($rg) + $rgName = $rg.ResourceGroupName + $cgName = New-LiveTestResourceName + $cgLocation = "westus" + $null = New-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Sku Basic + $null = Remove-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName + $GetServiceList = Get-AzContainerRegistry -ResourceGroupName $rgName + Assert-False { $GetServiceList.Name -contains $cgName} +} \ No newline at end of file From 923b7f139193b93336e20798735691c2c4bcab53 Mon Sep 17 00:00:00 2001 From: Nanxiang Liu Date: Sun, 26 Feb 2023 23:39:04 +0800 Subject: [PATCH 5/9] delete connectedkubernetes live test --- .../LiveTests/TestLiveScenarios.ps1 | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/ConnectedKubernetes/LiveTests/TestLiveScenarios.ps1 diff --git a/src/ConnectedKubernetes/LiveTests/TestLiveScenarios.ps1 b/src/ConnectedKubernetes/LiveTests/TestLiveScenarios.ps1 deleted file mode 100644 index 89e48566b5da..000000000000 --- a/src/ConnectedKubernetes/LiveTests/TestLiveScenarios.ps1 +++ /dev/null @@ -1,61 +0,0 @@ -Invoke-LiveTestScenario -Name "Create ConnectedKubernetes" -Description "Test New-AzConnectedKubernetes" -ScenarioScript ` -{ - param ($rg) - $rgName = $rg.ResourceGroupName - $ckName = New-LiveTestResourceName - $ckLocation = "westus" - $actual = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation - Assert-AreEqual $ckName $actual.Name - Assert-AreEqual $ckLocation $actual.Location -} - -Invoke-LiveTestScenario -Name "List ConnectedKubernetes" -Description "Test listing ConnectedKubernetes" -ScenarioScript ` -{ - param ($rg) - - $rgName = $rg.ResourceGroupName - $ckName = New-LiveTestResourceName - $ckLocation = "westus" - $null = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation - $actual = Get-AzConnectedKubernetes -ResourceGroupName $rgName - Assert-AreEqual 1 $actual.Count -} - -Invoke-LiveTestScenario -Name "Get ConnectedKubernetes" -Description "Test getting one ConnectedKubernetes" -ScenarioScript ` -{ - param ($rg) - - $rgName = $rg.ResourceGroupName - $ckName = New-LiveTestResourceName - $ckLocation = "westus" - $null = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation - $actual = Get-AzConnectedKubernetes -ResourceGroupName $rgName -ClusterName $ckName - Assert-AreEqual $ckName $actual.Name -} - -Invoke-LiveTestScenario -Name "Update ConnectedKubernetes" -Description "Test Updating one specific ConnectedKubernetes" -ScenarioScript ` -{ - param ($rg) - - $rgName = $rg.ResourceGroupName - $ckName = New-LiveTestResourceName - $ckLocation = "westus" - $tag = @{'key'='1'} - $null = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation - $null = Update-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Tag $tag - $actual = Get-AzConnectedKubernetes -ResourceGroupName $rgName -ClusterName $ckName - Assert-AreEqual $actual.$tag["key"] "1" -} - -Invoke-LiveTestScenario -Name "Remove ConnectedKubernetes" -Description "Test Removing ConnectedKubernetes" -ScenarioScript ` -{ - param ($rg) - - $rgName = $rg.ResourceGroupName - $ckName = New-LiveTestResourceName - $ckLocation = "westus" - $actual = New-AzConnectedKubernetes -ClusterName $ckName -ResourceGroupName $rgName -Location $ckLocation - Remove-AzConnectedKubernetes -ResourceGroupName $rgName -Name $ckName - $GetServiceList = Get-AzConnectedKubernetes -ResourceGroupName $rgName - Assert-False { $GetServiceList.Name -contains $rgName} -} \ No newline at end of file From ee5e0bc5de07183de91ecb7a25e7c80bb489621e Mon Sep 17 00:00:00 2001 From: NanxiangLiu <33285578+Nickcandy@users.noreply.github.com> Date: Sun, 26 Feb 2023 23:40:32 +0800 Subject: [PATCH 6/9] Delete id_rsa --- id_rsa | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 id_rsa diff --git a/id_rsa b/id_rsa deleted file mode 100644 index 43a397478fda..000000000000 --- a/id_rsa +++ /dev/null @@ -1,39 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -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 ------END OPENSSH PRIVATE KEY----- From 1aa3b2c2333b10e18a7dfca73be62169692e4bc8 Mon Sep 17 00:00:00 2001 From: NanxiangLiu <33285578+Nickcandy@users.noreply.github.com> Date: Sun, 26 Feb 2023 23:40:42 +0800 Subject: [PATCH 7/9] Delete id_rsa.pub --- id_rsa.pub | 1 - 1 file changed, 1 deletion(-) delete mode 100644 id_rsa.pub diff --git a/id_rsa.pub b/id_rsa.pub deleted file mode 100644 index 95545184dc7c..000000000000 --- a/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCvmu96bnRu4Cd2Lce2c+fRu43Uizx+OIZNCivwgAtLcd8cCXh0f8uolVTqoG0uexUdUuD8eCKCNxYx0SOqrkEPxVAUDJSj+InU6xL4SCPtzY0HsgkbzL5oY0Nmh0UgCMqJIdlhkBiuaKA+WMrPo02lzdZbEpSA3OxhE82tDInV67H1NvCgpejM4z6b0xPa8+T3RpHkAtOo62QqK3FdmUb5dZZeAdkM/OaGL13t6l8Nr6Ab7/+ppIi/0UzPLCV5gun6rt+NGNjDlyerMji8u1CFsLnzphaWQ0mq6ikzLhoPv3mMDaKBu+P1rAiJVNFv+5nIDjNGTl7sDRn3Jo9D4g3BKsDtTZGHxy4vuaNWmTzeEkJvQzZguyQB+OgWWDWZsuUp5iGK34h6ZaMAQ8DwPIZsnq46/J+66nU+/tRPxYnRajl/hflOgdypj4iLR/bcG2XC0MjfzzgYggsv4NS02wpOHxZUn/vFXYOv8ThjMj3d4mHgeanMewdUZUBXHFImQpM= redmond\nanxiangliu@DESKTOP-E7NG40Q From a3cec44ec5d13100ffd2b48adade4fa81098f049 Mon Sep 17 00:00:00 2001 From: Nanxiang Liu Date: Mon, 27 Feb 2023 17:53:42 +0800 Subject: [PATCH 8/9] delete connectedkubernetes live test --- src/App/Livetests/TestLiveScenarios.ps1 | 104 +++++------------------- 1 file changed, 19 insertions(+), 85 deletions(-) diff --git a/src/App/Livetests/TestLiveScenarios.ps1 b/src/App/Livetests/TestLiveScenarios.ps1 index 30bfc6778bf3..db2c96aa649e 100644 --- a/src/App/Livetests/TestLiveScenarios.ps1 +++ b/src/App/Livetests/TestLiveScenarios.ps1 @@ -1,111 +1,45 @@ -Invoke-LiveTestScenario -Name "Create ContainerApp" -Description "Test create AzContainerApp" -ScenarioScript ` +Invoke-LiveTestScenario -Name "List ContainerApp" -Description "Test listing ContainerApp" -ScenarioScript ` { param ($rg) $rgName = $rg.ResourceGroupName $appName = New-LiveTestResourceName + $workspaceName = New-LiveTestResourceName + $envName = New-LiveTestResourceName + $headerName = New-LiveTestResourceName + $secretName = New-LiveTestResourceName $appLocation = "westus" - $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" - $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId - $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name $workspaceName -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" + $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name $workspaceName).CustomerId + $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name $workspaceName).PrimarySharedKey + $null = New-AzContainerAppManagedEnv -EnvName $workspaceName -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 - $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" - $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome + $secretObject = New-AzContainerAppSecretObject -Name $secretName -Value "facebook-password" + $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name $headerName -Value Awesome $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi - $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id + $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName $workspaceName).Id $scaleRule = @() + # Test creating AzContainerApp $actual = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule Assert-AreEqual $appName $actual.Name Assert-AreEqual 8080 $actual.DaprAppPort -} - -Invoke-LiveTestScenario -Name "List ContainerApp" -Description "Test listing ContainerApp" -ScenarioScript ` -{ - param ($rg) - $rgName = $rg.ResourceGroupName - $appName = New-LiveTestResourceName - $appLocation = "westus" - $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" - $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId - $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false - $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 - $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" - $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome - $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader - $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi - $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id - $scaleRule = @() + # Test listing ContainerApp $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule $actual = Get-AzContainerApp -ResourceGroupName $rgName Assert-AreEqual 1 $actual.Count -} - -Invoke-LiveTestScenario -Name "Get ContainerApp" -Description "Test getting one ContainerApp" -ScenarioScript ` -{ - param ($rg) - $rgName = $rg.ResourceGroupName - $appName = New-LiveTestResourceName - $appLocation = "westus" - $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" - $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId - $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false - $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 - $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" - $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome - $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader - $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi - $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id - $scaleRule = @() + # Test getting one ContainerApp $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName Assert-AreEqual $appName $actual.Name -} - -Invoke-LiveTestScenario -Name "Update ContainerApp" -Description "Test Updating one specific ContainerApp" -ScenarioScript ` -{ - param ($rg) - $rgName = $rg.ResourceGroupName - $appName = New-LiveTestResourceName - $appLocation = "westus" - $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" - $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId - $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false - $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 - $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" - $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome - $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader - $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi - $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id - $scaleRule = @() + # Test Updating one specific ContainerApp $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule $null = Update-AzContainerApp -Name $appName -ResourceGroupName $rgName -DaprAppPort 8888 -Location $appLocation $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName Assert-AreEqual $actual.DaprAppPort 8888 -} - -Invoke-LiveTestScenario -Name "Remove ContainerApp" -Description "Test Removing ContainerApp" -ScenarioScript ` -{ - param ($rg) - $rgName = $rg.ResourceGroupName - $appName = New-LiveTestResourceName - $appLocation = "westus" - $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" - $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name workspace-azpstestgp).CustomerId - $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name workspace-azpstestgp).PrimarySharedKey - $null = New-AzContainerAppManagedEnv -EnvName azps-env -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false - $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 - $secretObject = New-AzContainerAppSecretObject -Name "facebook-secret" -Value "facebook-password" - $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name Custom-Header -Value Awesome - $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader - $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi - $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName azps-env).Id - $scaleRule = @() + # Test Removing ContainerApp $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule $null = Remove-AzContainerApp -ResourceGroupName $rgName -Name $appName $GetServiceList = Get-AzContainerApp -ResourceGroupName $rgName Assert-False { $GetServiceList.Name -contains $appName} -} \ No newline at end of file + +} From 69403d42bbe9244b28c2c7886ce477c7cd78362a Mon Sep 17 00:00:00 2001 From: Nanxiang Liu Date: Tue, 28 Feb 2023 13:05:32 +0800 Subject: [PATCH 9/9] revise live test --- src/App/Livetests/TestLiveScenarios.ps1 | 6 +++--- src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 | 4 ++-- src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/App/Livetests/TestLiveScenarios.ps1 b/src/App/Livetests/TestLiveScenarios.ps1 index db2c96aa649e..74eb8dc8d352 100644 --- a/src/App/Livetests/TestLiveScenarios.ps1 +++ b/src/App/Livetests/TestLiveScenarios.ps1 @@ -11,13 +11,13 @@ Invoke-LiveTestScenario -Name "List ContainerApp" -Description "Test listing Con $null = New-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name $workspaceName -Sku PerGB2018 -Location $appLocation -PublicNetworkAccessForIngestion "Enabled" -PublicNetworkAccessForQuery "Enabled" $CustomId = (Get-AzOperationalInsightsWorkspace -ResourceGroupName $rgName -Name $workspaceName).CustomerId $SharedKey = (Get-AzOperationalInsightsWorkspaceSharedKey -ResourceGroupName $rgName -Name $workspaceName).PrimarySharedKey - $null = New-AzContainerAppManagedEnv -EnvName $workspaceName -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false + $null = New-AzContainerAppManagedEnv -EnvName $envName -ResourceGroupName $rgName -Location $appLocation -AppLogConfigurationDestination "log-analytics" -LogAnalyticConfigurationCustomerId $CustomId -LogAnalyticConfigurationSharedKey $SharedKey -VnetConfigurationInternal:$false $trafficWeight = New-AzContainerAppTrafficWeightObject -Label production -LatestRevision $True -Weight 100 $secretObject = New-AzContainerAppSecretObject -Name $secretName -Value "facebook-password" $containerAppHttpHeader = New-AzContainerAppProbeHeaderObject -Name $headerName -Value Awesome $probe = New-AzContainerAppProbeObject -HttpGetPath "/health" -HttpGetPort 8080 -InitialDelaySecond 3 -PeriodSecond 3 -Type Liveness -HttpGetHttpHeader $containerAppHttpHeader $image = New-AzContainerAppTemplateObject -Name $appName -Image mcr.microsoft.com/azuredocs/containerapps-helloworld:latest -Probe $probe -ResourceCpu 2.0 -ResourceMemory 4.0Gi - $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName $workspaceName).Id + $EnvId = (Get-AzContainerAppManagedEnv -ResourceGroupName $rgName -EnvName $envName).Id $scaleRule = @() # Test creating AzContainerApp $actual = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule @@ -26,7 +26,7 @@ Invoke-LiveTestScenario -Name "List ContainerApp" -Description "Test listing Con # Test listing ContainerApp $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule $actual = Get-AzContainerApp -ResourceGroupName $rgName - Assert-AreEqual 1 $actual.Count + Assert-True { $actual.Count -ge 1 } # Test getting one ContainerApp $null = New-AzContainerApp -Name $appName -ResourceGroupName $rgName -Location $appLocation -ConfigurationActiveRevisionsMode 'Single' -ManagedEnvironmentId $EnvId -IngressExternal -IngressTransport 'auto' -IngressTargetPort 80 -TemplateContainer $image -ConfigurationSecret $secretObject -IngressTraffic $trafficWeight -DaprEnabled -DaprAppProtocol 'http' -DaprAppId "container-app-1" -DaprAppPort 8080 -ScaleRule $scaleRule $actual = Get-AzContainerApp -ResourceGroupName $rgName -Name $appName diff --git a/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 b/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 index 5edb67db1d99..93daa53c36f1 100644 --- a/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 +++ b/src/ContainerInstance/LiveTests/TestLiveScenarios.ps1 @@ -22,7 +22,7 @@ Invoke-LiveTestScenario -Name "List ContainerGroup" -Description "Test listing C $container = New-AzContainerInstanceObject -Name $containerName -Image alpine $null = New-AzContainerGroup -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Container $container $actual = Get-AzContainerGroup -ResourceGroupName $rgName - Assert-AreEqual 1 $actual.Count + Assert-True { $actual.Count -ge 1 } } Invoke-LiveTestScenario -Name "Get ContainerGroup" -Description "Test getting one ContainerGroup" -ScenarioScript ` @@ -52,7 +52,7 @@ Invoke-LiveTestScenario -Name "Update ContainerGroup" -Description "Test Updatin $null = New-AzContainerGroup -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Container $container $null = Update-AzContainerGroup -Name $cgName -ResourceGroupName $rgName -Tag $tag $actual = Get-AzContainerGroup -ResourceGroupName $rgName -Name $cgName - Assert-AreEqual $actual.$tag.Count 1 + Assert-AreEqual $actual.tag.Count 1 } Invoke-LiveTestScenario -Name "Remove ContainerGroup" -Description "Test Removing ContainerGroup" -ScenarioScript ` diff --git a/src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 b/src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 index f9fdc255d5ac..479ed968b5e6 100644 --- a/src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 +++ b/src/ContainerRegistry/LiveTests/TestLiveScenarios.ps1 @@ -18,7 +18,7 @@ Invoke-LiveTestScenario -Name "List ContainerRegistry" -Description "Test listin $cgLocation = "westus" $null = New-AzContainerRegistry -ResourceGroupName $rgName -Name $cgName -Location $cgLocation -Sku Basic $actual = Get-AzContainerRegistry -ResourceGroupName $rgName - Assert-AreEqual 1 $actual.Count + Assert-True { $actual.Count -ge 1 } } Invoke-LiveTestScenario -Name "Get ContainerRegistry" -Description "Test getting one ContainerRegistry" -ScenarioScript `