Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ class ContainerappIdentityTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_identity_e2e(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
user_identity_name = self.create_random_name(prefix='containerapp', length=24)

create_containerapp_env(self, env_name, resource_group, "eastus2")
create_containerapp_env(self, env_name, resource_group)

self.cmd('containerapp create -g {} -n {} --environment {}'.format(resource_group, ca_name, env_name))

Expand Down Expand Up @@ -60,14 +65,19 @@ def test_containerapp_identity_e2e(self, resource_group):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="canadacentral")
def test_containerapp_identity_system(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
logs_workspace_name = self.create_random_name(prefix='containerapp-env', length=24)

logs_workspace_id = self.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = self.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]

self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {} -l canadacentral'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
self.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))

containerapp_env = self.cmd('containerapp env show -g {} -n {}'.format(resource_group, env_name)).get_output_in_json()

Expand Down Expand Up @@ -96,12 +106,17 @@ def test_containerapp_identity_system(self, resource_group):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="westeurope")
def test_containerapp_identity_user(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)
user_identity_name1 = self.create_random_name(prefix='containerapp-user1', length=24)
user_identity_name2 = self.create_random_name(prefix='containerapp-user2', length=24)

create_containerapp_env(self, env_name, resource_group, "westeurope")
create_containerapp_env(self, env_name, resource_group)

self.cmd('containerapp create -g {} -n {} --environment {}'.format(resource_group, ca_name, env_name))

Expand Down Expand Up @@ -146,6 +161,11 @@ class ContainerappIngressTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_ingress_e2e(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)

Expand Down Expand Up @@ -183,6 +203,11 @@ def test_containerapp_ingress_e2e(self, resource_group):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_ingress_traffic_e2e(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)

Expand Down Expand Up @@ -227,6 +252,11 @@ def test_containerapp_ingress_traffic_e2e(self, resource_group):
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live)
@ResourceGroupPreparer(location="westeurope")
def test_containerapp_custom_domains_e2e(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)

Expand Down Expand Up @@ -345,6 +375,11 @@ def test_containerapp_custom_domains_e2e(self, resource_group):
@ResourceGroupPreparer(location="northeurope")
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live) and vnet command error in cli pipeline
def test_containerapp_tcp_ingress(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='env', length=24)
logs = self.create_random_name(prefix='logs', length=24)
vnet = self.create_random_name(prefix='name', length=24)
Expand All @@ -356,7 +391,7 @@ def test_containerapp_tcp_ingress(self, resource_group):
logs_id = self.cmd(f"monitor log-analytics workspace create -g {resource_group} -n {logs}").get_output_in_json()["customerId"]
logs_key = self.cmd(f'monitor log-analytics workspace get-shared-keys -g {resource_group} -n {logs}').get_output_in_json()["primarySharedKey"]

self.cmd(f'containerapp env create -g {resource_group} -n {env_name} --logs-workspace-id {logs_id} --logs-workspace-key {logs_key} --internal-only -s {sub_id} --location northeurope')
self.cmd(f'containerapp env create -g {resource_group} -n {env_name} --logs-workspace-id {logs_id} --logs-workspace-key {logs_key} --internal-only -s {sub_id}')

containerapp_env = self.cmd(f'containerapp env show -g {resource_group} -n {env_name}').get_output_in_json()

Expand Down Expand Up @@ -399,10 +434,15 @@ def test_containerapp_tcp_ingress(self, resource_group):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="northeurope")
def test_containerapp_ip_restrictions(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)

create_containerapp_env(self, env_name, resource_group, "northeurope")
create_containerapp_env(self, env_name, resource_group)

# self.cmd('containerapp create -g {} -n {} --environment {}'.format(resource_group, ca_name, env_name))
self.cmd('containerapp create -g {} -n {} --environment {} --ingress external --target-port 80'.format(resource_group, ca_name, env_name))
Expand Down Expand Up @@ -468,6 +508,11 @@ def test_containerapp_ip_restrictions(self, resource_group):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="northeurope")
def test_containerapp_ip_restrictions_deny(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)

Expand Down Expand Up @@ -539,10 +584,15 @@ class ContainerappDaprTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_dapr_e2e(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)

create_containerapp_env(self, env_name, resource_group, "eastus2")
create_containerapp_env(self, env_name, resource_group)

self.cmd('containerapp create -g {} -n {} --environment {} --dapr-app-id containerapp --dapr-app-port 800 --dapr-app-protocol grpc --dhmrs 4 --dhrbs 50 --dapr-log-level debug --enable-dapr'.format(resource_group, ca_name, env_name), checks=[
JMESPathCheck('properties.configuration.dapr.appId', "containerapp"),
Expand Down Expand Up @@ -605,6 +655,11 @@ class ContainerappEnvStorageTests(ScenarioTest):
@live_only() # Passes locally but fails in CI
@ResourceGroupPreparer(location="eastus")
def test_containerapp_env_storage(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
storage_name = self.create_random_name(prefix='storage', length=24)
shares_name = self.create_random_name(prefix='share', length=24)
Expand Down Expand Up @@ -639,6 +694,11 @@ class ContainerappRevisionTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="northeurope")
def test_containerapp_revision_label_e2e(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
ca_name = self.create_random_name(prefix='containerapp', length=24)

Expand Down Expand Up @@ -704,6 +764,11 @@ class ContainerappAnonymousRegistryTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="northeurope")
def test_containerapp_anonymous_registry(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
image = "mcr.microsoft.com/azuredocs/containerapps-helloworld:latest"
Expand All @@ -720,14 +785,19 @@ class ContainerappRegistryIdentityTests(ScenarioTest):
@ResourceGroupPreparer(location="westeurope")
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live)
def test_containerapp_registry_identity_user(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
identity = self.create_random_name(prefix='id', length=24)
acr = self.create_random_name(prefix='acr', length=24)
image_source = "mcr.microsoft.com/azuredocs/containerapps-helloworld:latest"
image_name = f"{acr}.azurecr.io/azuredocs/containerapps-helloworld:latest"

create_containerapp_env(self, env, resource_group, "westeurope")
create_containerapp_env(self, env, resource_group)

identity_rid = self.cmd(f'identity create -g {resource_group} -n {identity}').get_output_in_json()["id"]

Expand All @@ -742,13 +812,18 @@ def test_containerapp_registry_identity_user(self, resource_group):
@ResourceGroupPreparer(location="westeurope")
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live)
def test_containerapp_registry_identity_system(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
acr = self.create_random_name(prefix='acr', length=24)
image_source = "mcr.microsoft.com/azuredocs/containerapps-helloworld:latest"
image_name = f"{acr}.azurecr.io/azuredocs/containerapps-helloworld:latest"

create_containerapp_env(self, env, resource_group, "westeurope")
create_containerapp_env(self, env, resource_group)

self.cmd(f'acr create --sku basic -n {acr} -g {resource_group} --admin-enabled')
self.cmd(f'acr import -n {acr} --source {image_source}')
Expand All @@ -762,6 +837,11 @@ class ContainerappScaleTests(ScenarioTest):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="westeurope")
def test_containerapp_scale_create(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)

Expand Down Expand Up @@ -795,6 +875,11 @@ def test_containerapp_scale_create(self, resource_group):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="westeurope")
def test_containerapp_scale_update(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)

Expand Down Expand Up @@ -828,6 +913,11 @@ def test_containerapp_scale_update(self, resource_group):
@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="westeurope")
def test_containerapp_scale_revision_copy(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import os
import unittest # pylint: disable=unused-import

from azure.cli.testsdk import (ResourceGroupPreparer)
Expand All @@ -20,6 +20,11 @@ class ContainerappComposeBaseScenarioTest(ContainerappComposePreviewScenarioTest
@serial_test()
@ResourceGroupPreparer(name_prefix='cli_test_containerapp_preview', location='eastus')
def test_containerapp_compose_create_basic_no_existing_resources(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

compose_text = """
services:
foo:
Expand All @@ -34,7 +39,7 @@ def test_containerapp_compose_create_basic_no_existing_resources(self, resource_
'compose': compose_file_name,
})

create_containerapp_env(self, env_name, resource_group, 'eastus')
create_containerapp_env(self, env_name, resource_group)

command_string = 'containerapp compose create'
command_string += ' --compose-file-path {compose}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

import os
import unittest # pylint: disable=unused-import

from azure.cli.testsdk import (ResourceGroupPreparer)
Expand All @@ -19,6 +19,11 @@ class ContainerappComposePreviewCommandScenarioTest(ContainerappComposePreviewSc
@serial_test()
@ResourceGroupPreparer(name_prefix='cli_test_containerapp_preview', location='eastus')
def test_containerapp_compose_with_command_string(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

compose_text = """
services:
foo:
Expand All @@ -37,7 +42,7 @@ def test_containerapp_compose_with_command_string(self, resource_group):
'compose': compose_file_name,
})

create_containerapp_env(self, env_name, resource_group, 'eastus')
create_containerapp_env(self, env_name, resource_group)

command_string = 'containerapp compose create'
command_string += ' --compose-file-path {compose}'
Expand All @@ -52,6 +57,11 @@ def test_containerapp_compose_with_command_string(self, resource_group):
@serial_test()
@ResourceGroupPreparer(name_prefix='cli_test_containerapp_preview', location='eastus')
def test_containerapp_compose_with_command_list(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

compose_text = """
services:
foo:
Expand All @@ -68,7 +78,7 @@ def test_containerapp_compose_with_command_list(self, resource_group):
'compose': compose_file_name,
})

create_containerapp_env(self, env_name, resource_group, 'eastus')
create_containerapp_env(self, env_name, resource_group)

command_string = 'containerapp compose create'
command_string += ' --compose-file-path {compose}'
Expand All @@ -83,6 +93,11 @@ def test_containerapp_compose_with_command_list(self, resource_group):
@serial_test()
@ResourceGroupPreparer(name_prefix='cli_test_containerapp_preview', location='eastus')
def test_containerapp_compose_with_command_list_and_entrypoint(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))

compose_text = """
services:
foo:
Expand All @@ -101,7 +116,7 @@ def test_containerapp_compose_with_command_list_and_entrypoint(self, resource_gr
'compose': compose_file_name,
})

create_containerapp_env(self, env_name, resource_group, 'eastus')
create_containerapp_env(self, env_name, resource_group)

command_string = 'containerapp compose create'
command_string += ' --compose-file-path {compose}'
Expand Down
Loading