Skip to content

Commit

Permalink
containerapp add three type for enable workload profiles (#6647)
Browse files Browse the repository at this point in the history
  • Loading branch information
Greedygre authored Aug 16, 2023
1 parent e7d24f8 commit dc27eeb
Show file tree
Hide file tree
Showing 8 changed files with 8,718 additions and 8,960 deletions.
1 change: 1 addition & 0 deletions src/containerapp/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release History
upcoming
++++++
* Removed preview tag for some command groups and params (e.g. 'az containerapp job', 'az containerapp env storage', 'az containerapp env workload-profile')
* 'az containerapp env': --enable-workload-profiles allowed values:true, false

0.3.37
++++++
Expand Down
2 changes: 1 addition & 1 deletion src/containerapp/azext_containerapp/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def load_arguments(self, _):

with self.argument_context('containerapp env create') as c:
c.argument('zone_redundant', options_list=["--zone-redundant", "-z"], help="Enable zone redundancy on the environment. Cannot be used without --infrastructure-subnet-resource-id. If used with --location, the subnet's location must match")
c.argument('enable_workload_profiles', action='store_true', options_list=["--enable-workload-profiles", "-w"], help="Allow this environment to have workload profiles", is_preview=True)
c.argument('enable_workload_profiles', arg_type=get_three_state_flag(), options_list=["--enable-workload-profiles", "-w"], help="Boolean indicating if the environment is enabled to have workload profiles", is_preview=True)

with self.argument_context('containerapp env update') as c:
c.argument('name', name_type, help='Name of the Container Apps environment.')
Expand Down

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 @@ -142,6 +142,37 @@ def test_containerapp_env_workload_profiles_delete(self, resource_group):
profiles = self.cmd("az containerapp env workload-profile list -g {} -n {}".format(resource_group, env)).get_output_in_json()
self.assertEqual(len(profiles), 1)

@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus")
def test_containerapp_create_enable_workload_profiles_three_state_flag(self, resource_group):
self.cmd('configure --defaults location={}'.format(TEST_LOCATION))
env = self.create_random_name(prefix='env', length=24)
self.cmd('containerapp env create -g {} -n {} --logs-destination none --enable-workload-profiles false'.format(resource_group, env), expect_failure=False, checks=[
JMESPathCheck("name", env),
JMESPathCheck("properties.provisioningState", "Succeeded"),
JMESPathCheck("properties.workloadProfiles", None),
])
env2 = self.create_random_name(prefix='env2', length=24)
self.cmd('containerapp env create -g {} -n {} --logs-destination none --enable-workload-profiles'.format(
resource_group, env2), expect_failure=False, checks=[
JMESPathCheck("name", env2),
JMESPathCheck("properties.provisioningState", "Succeeded"),
JMESPathCheck("length(properties.workloadProfiles)", 1),
JMESPathCheck('properties.workloadProfiles[0].name', "Consumption", case_sensitive=False),
JMESPathCheck('properties.workloadProfiles[0].workloadProfileType', "Consumption", case_sensitive=False),
])

env3 = self.create_random_name(prefix='env3', length=24)
self.cmd('containerapp env create -g {} -n {} --logs-destination none --enable-workload-profiles true'.format(
resource_group, env3), expect_failure=False, checks=[
JMESPathCheck("name", env3),
JMESPathCheck("properties.provisioningState", "Succeeded"),
JMESPathCheck("length(properties.workloadProfiles)", 1),
JMESPathCheck('properties.workloadProfiles[0].name', "Consumption", case_sensitive=False),
JMESPathCheck('properties.workloadProfiles[0].workloadProfileType', "Consumption", case_sensitive=False),
])


@AllowLargeResponse(8192)
@ResourceGroupPreparer(location="eastus")
def test_containerapp_create_with_workloadprofile_yaml(self, resource_group):
Expand Down

0 comments on commit dc27eeb

Please sign in to comment.