Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine location config in test for container apps #5868

Merged
merged 2 commits into from
Feb 9, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from azure.cli.testsdk import (ScenarioTest)

TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
TEST_LOCATION = os.getenv("CLITestLocation") if os.getenv("CLITestLocation") else "eastus"


def write_test_file(filename, content):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from azure.cli.testsdk import (ScenarioTest, ResourceGroupPreparer, JMESPathCheck)
from msrestazure.tools import parse_resource_id

from .common import TEST_LOCATION
from .utils import create_containerapp_env

TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..'))
Expand All @@ -19,10 +20,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -65,10 +63,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -106,10 +101,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -161,10 +153,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -203,10 +192,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -252,10 +238,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -375,10 +358,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

env_name = self.create_random_name(prefix='env', length=24)
logs = self.create_random_name(prefix='logs', length=24)
Expand Down Expand Up @@ -434,10 +414,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -508,10 +485,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -584,10 +558,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -653,11 +624,7 @@ def test_containerapp_dapr_e2e(self, resource_group):
@ResourceGroupPreparer(location="eastus2")
def test_containerapp_up_dapr_e2e(self, resource_group):
""" Ensure that dapr can be enabled if the app has been created using containerapp up """
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'

self.cmd('configure --defaults location={}'.format(location))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

image = 'mcr.microsoft.com/azuredocs/aks-helloworld:v1'
env_name = self.create_random_name(prefix='containerapp-env', length=24)
Expand All @@ -683,10 +650,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

env_name = self.create_random_name(prefix='containerapp-env', length=24)
storage_name = self.create_random_name(prefix='storage', length=24)
Expand Down Expand Up @@ -722,10 +686,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -792,10 +753,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
Expand All @@ -813,10 +771,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
Expand All @@ -840,10 +795,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
Expand All @@ -865,10 +817,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
Expand Down Expand Up @@ -903,10 +852,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

env = self.create_random_name(prefix='env', length=24)
app = self.create_random_name(prefix='aca', length=24)
Expand Down Expand Up @@ -941,10 +887,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_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 @@ -7,10 +7,11 @@

from azure.cli.testsdk import (ResourceGroupPreparer)
from azure.cli.testsdk.decorators import serial_test
from azext_containerapp.tests.latest.common import (ContainerappComposePreviewScenarioTest, # pylint: disable=unused-import
write_test_file,
clean_up_test_file,
TEST_DIR)
from azext_containerapp.tests.latest.common import (
ContainerappComposePreviewScenarioTest, # pylint: disable=unused-import
write_test_file,
clean_up_test_file,
TEST_DIR, TEST_LOCATION)

from .utils import create_containerapp_env

Expand All @@ -20,10 +21,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

compose_text = """
services:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

from azure.cli.testsdk import (ResourceGroupPreparer)
from azure.cli.testsdk.decorators import serial_test
from azext_containerapp.tests.latest.common import (ContainerappComposePreviewScenarioTest, # pylint: disable=unused-import
write_test_file,
clean_up_test_file,
TEST_DIR)
from azext_containerapp.tests.latest.common import (
ContainerappComposePreviewScenarioTest, # pylint: disable=unused-import
write_test_file,
clean_up_test_file,
TEST_DIR, TEST_LOCATION)

from .utils import create_containerapp_env

Expand All @@ -19,10 +20,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

compose_text = """
services:
Expand Down Expand Up @@ -57,10 +55,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

compose_text = """
services:
Expand Down Expand Up @@ -93,10 +88,7 @@ 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))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

compose_text = """
services:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

from azure.cli.testsdk import (ResourceGroupPreparer)
from azure.cli.testsdk.decorators import serial_test
from azext_containerapp.tests.latest.common import (ContainerappComposePreviewScenarioTest, # pylint: disable=unused-import
write_test_file,
clean_up_test_file,
TEST_DIR)
from azext_containerapp.tests.latest.common import (
ContainerappComposePreviewScenarioTest, # pylint: disable=unused-import
write_test_file,
clean_up_test_file,
TEST_DIR, TEST_LOCATION)

from .utils import create_containerapp_env

Expand All @@ -19,10 +20,7 @@ class ContainerappComposePreviewEnvironmentSettingsScenarioTest(ContainerappComp
@serial_test()
@ResourceGroupPreparer(name_prefix='cli_test_containerapp_preview', location='eastus')
def test_containerapp_compose_create_with_environment(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

compose_text = """
services:
Expand Down Expand Up @@ -65,10 +63,7 @@ class ContainerappComposePreviewEnvironmentSettingsExpectedExceptionScenarioTest
@serial_test()
@ResourceGroupPreparer(name_prefix='cli_test_containerapp_preview', location='eastus')
def test_containerapp_compose_create_with_environment_prompt(self, resource_group):
location = os.getenv("CLITestLocation")
if not location:
location = 'eastus'
self.cmd('configure --defaults location={}'.format(location))
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))

compose_text = """
services:
Expand Down
Loading