Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StrawnSC committed Sep 22, 2022
1 parent 226c11e commit bb564dc
Show file tree
Hide file tree
Showing 7 changed files with 13,995 additions and 6,408 deletions.

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 @@ -525,6 +525,7 @@ def test_containerapp_anonymous_registry(self, resource_group):
class ContainerappRegistryIdentityTests(ScenarioTest):
@AllowLargeResponse(8192)
@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):
env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
Expand All @@ -533,7 +534,7 @@ def test_containerapp_registry_identity_user(self, resource_group):
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)
create_containerapp_env(self, env, resource_group, "westeurope")

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def test_containerapp_env_e2e(self, resource_group):

@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="northeurope")
@live_only() # encounters 'CannotOverwriteExistingCassetteException' only when run from recording (passes when run live)
def test_containerapp_env_dapr_components(self, resource_group):
env_name = self.create_random_name(prefix='containerapp-e2e-env', length=24)
dapr_comp_name = self.create_random_name(prefix='dapr-component', length=24)
Expand Down
7 changes: 5 additions & 2 deletions src/containerapp/azext_containerapp/tests/latest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
import time


def create_containerapp_env(test_cls, env_name, resource_group):
def create_containerapp_env(test_cls, env_name, resource_group, location=None):
logs_workspace_name = test_cls.create_random_name(prefix='containerapp-env', length=24)
logs_workspace_id = test_cls.cmd('monitor log-analytics workspace create -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["customerId"]
logs_workspace_key = test_cls.cmd('monitor log-analytics workspace get-shared-keys -g {} -n {}'.format(resource_group, logs_workspace_name)).get_output_in_json()["primarySharedKey"]

test_cls.cmd('containerapp env create -g {} -n {} --logs-workspace-id {} --logs-workspace-key {}'.format(resource_group, env_name, logs_workspace_id, logs_workspace_key))
if location:
test_cls.cmd(f'containerapp env create -g {resource_group} -n {env_name} --logs-workspace-id {logs_workspace_id} --logs-workspace-key {logs_workspace_key} -l {location}')
else:
test_cls.cmd(f'containerapp env create -g {resource_group} -n {env_name} --logs-workspace-id {logs_workspace_id} --logs-workspace-key {logs_workspace_key}')

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

Expand Down

0 comments on commit bb564dc

Please sign in to comment.