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
2 changes: 1 addition & 1 deletion src/devcenter/azext_devcenter/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@
--project-name "DevProject"
- name: List using endpoint
text: |-
az devcenter dev environment-definition list --dev-center-name "ContosoDevCenter" \
az devcenter dev environment-definition list --endpoint "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com/" \
--project-name "DevProject"
- name: List by catalog using dev center
text: |-
Expand Down
1 change: 1 addition & 0 deletions src/devcenter/azext_devcenter/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# pylint: disable=line-too-long
# pylint: disable=unused-import
# pylint: disable=too-many-statements
# pylint: disable=too-many-lines

from knack.arguments import CLIArgumentType
from azure.cli.core.commands.parameters import (
Expand Down
4 changes: 0 additions & 4 deletions src/devcenter/azext_devcenter/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------


# pylint: disable=protected-access

# pylint: disable=no-self-use


import argparse
from collections import defaultdict
Expand Down
1 change: 1 addition & 0 deletions src/devcenter/azext_devcenter/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# pylint: disable=protected-access
# pylint: disable=too-many-lines

from datetime import datetime
import json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# regenerated.
# --------------------------------------------------------------------------

import os
from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, record_only
from azure.cli.testsdk.scenario_tests import AllowLargeResponse
from .. import (
Expand All @@ -35,7 +34,7 @@
create_dev_box_dependencies,
get_endpoint,
login_account,
get_aad_id
get_aad_id,
)


Expand Down Expand Up @@ -927,7 +926,6 @@ def test_pool_scenario(self):
self.check("location", "{location}"),
self.check("virtualNetworkType", "Unmanaged"),
self.check("singleSignOnStatus", "Enabled"),

],
)

Expand Down Expand Up @@ -959,7 +957,7 @@ def test_pool_scenario(self):
self.check("virtualNetworkType", "Managed"),
self.check("singleSignOnStatus", "Disabled"),
self.check("managedVirtualNetworkRegions[0]", "canadacentral"),
self.check("healthStatus", "Warning")
self.check("healthStatus", "Warning"),
],
)

Expand All @@ -975,7 +973,7 @@ def test_pool_scenario(self):
self.check("localAdministrator", "Enabled"),
self.check("networkConnectionName", "{attachedNetworkName}"),
self.check("location", "{location}"),
self.check("devBoxCount", 0)
self.check("devBoxCount", 0),
],
)

Expand All @@ -987,7 +985,6 @@ def test_pool_scenario(self):
checks=[],
)


self.cmd(
"az devcenter admin schedule create "
'--pool-name "{poolName}" '
Expand Down Expand Up @@ -1261,7 +1258,6 @@ def test_env_definition_scenario(self):
],
)


@ResourceGroupPreparer(
name_prefix="clitestdevcenter_rg1"[:7], key="rg", parameter_name="rg"
)
Expand Down Expand Up @@ -1494,26 +1490,22 @@ def __init__(self, *args, **kwargs):
{
"subscriptionId": self.get_subscription_id(),
"location": "canadacentral",
"userName": "[email protected]" #update to your guest account
"userName": "[email protected]", # update to your guest account
}
)
login_account(self)
get_aad_id(self)

def test_project_dataplane_scenario(self):

self.kwargs.update(
{
"devcenterName": self.create_random_name(prefix="cli", length=24),
"location": "canadacentral",
"rg": self.create_random_name(prefix="cli", length=24)
"rg": self.create_random_name(prefix="cli", length=24),
}
)

self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')

create_dev_center(self)
create_project_with_dev_box_limit(self)
Expand Down Expand Up @@ -1566,22 +1558,19 @@ def test_pool_dataplane_scenario(self):
{
"location": "canadacentral",
"devcenterName": self.create_random_name(prefix="cli", length=24),
"rg": self.create_random_name(prefix="cli", length=24)
"rg": self.create_random_name(prefix="cli", length=24),
}
)

self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')

create_dev_center(self)
create_project(self)
get_endpoint(self)
add_dev_box_user_role_to_project(self)
create_pool(self)
login_account(self)

self.cmd(
"az devcenter dev pool list "
'--dev-center "{devcenterName}" '
Expand Down Expand Up @@ -1695,14 +1684,11 @@ def test_catalog_dataplane_scenario(self):
self.kwargs.update(
{
"location": "canadacentral",
"rg": self.create_random_name(prefix="cli", length=24)
"rg": self.create_random_name(prefix="cli", length=24),
}
)

self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')
create_catalog(self)
login_account(self)

Expand Down Expand Up @@ -1752,14 +1738,11 @@ def test_env_definition_dataplane_scenario(self):
self.kwargs.update(
{
"location": "canadacentral",
"rg": self.create_random_name(prefix="cli", length=24)
"rg": self.create_random_name(prefix="cli", length=24),
}
)

self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')
create_catalog(self)
login_account(self)
function_app_id = f"/projects/{self.kwargs.get('projectName', '')}/catalogs/{self.kwargs.get('catalogName', '')}/environmentDefinitions/functionapp"
Expand Down Expand Up @@ -1849,14 +1832,11 @@ def test_env_type_dataplane_scenario(self):
self.kwargs.update(
{
"location": "canadacentral",
"rg": self.create_random_name(prefix="cli", length=24)
"rg": self.create_random_name(prefix="cli", length=24),
}
)

self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')
create_proj_env_type(self)
login_account(self)

Expand All @@ -1871,20 +1851,15 @@ def test_env_type_dataplane_scenario(self):
],
)


def test_dev_box_dataplane_scenario(self):
self.kwargs.update(
{
"location": "canadacentral",
"devBoxName": self.create_random_name(prefix="cli", length=24),
"rg": self.create_random_name(prefix="cli", length=24)

"rg": self.create_random_name(prefix="cli", length=24),
}
)
self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')
create_dev_box_dependencies(self)
login_account(self)

Expand Down Expand Up @@ -2093,8 +2068,7 @@ def test_dev_box_dataplane_scenario(self):
checks=[
self.check("[0].action.name", "{actionName}"),
self.check("[0].action.actionType", "Stop"),
self.exists(
"[0].action.next.scheduledTime"),
self.exists("[0].action.next.scheduledTime"),
self.exists("[0].action.suspendedUntil"),
self.check(
"[0].action.sourceId",
Expand Down Expand Up @@ -2143,21 +2117,16 @@ def test_dev_box_dataplane_scenario(self):
],
)


@AllowLargeResponse()
def test_environment_dataplane_scenario(self):
self.kwargs.update(
{
"envName": self.create_random_name(prefix="cli", length=12),
"location": "centraluseuap",
"rg": self.create_random_name(prefix="cli", length=24)

"rg": self.create_random_name(prefix="cli", length=24),
}
)
self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')
create_environment_dependencies(self)
login_account(self)

Expand Down Expand Up @@ -2266,14 +2235,10 @@ def test_environment_operations_dataplane_scenario(self):
"envName": self.create_random_name(prefix="cli", length=12),
"location": "centraluseuap",
"rg": self.create_random_name(prefix="cli", length=24),
"environmentDefinitionName": "Sandbox"

"environmentDefinitionName": "Sandbox",
}
)
self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')
create_environment_dependencies(self)
login_account(self)

Expand Down Expand Up @@ -2301,7 +2266,7 @@ def test_environment_operations_dataplane_scenario(self):
self.check("environmentType", "{envTypeName}"),
self.check("name", "{envName}"),
self.check("provisioningState", "Succeeded"),
self.check("expirationDate", "2025-11-30T22:35:00+00:00")
self.check("expirationDate", "2025-11-30T22:35:00+00:00"),
],
)

Expand All @@ -2317,7 +2282,7 @@ def test_environment_operations_dataplane_scenario(self):
self.check("environmentType", "{envTypeName}"),
self.check("name", "{envName}"),
self.check("provisioningState", "Succeeded"),
self.check("expirationDate", "2025-12-30T22:35:00+00:00")
self.check("expirationDate", "2025-12-30T22:35:00+00:00"),
],
)

Expand All @@ -2340,12 +2305,12 @@ def test_environment_operations_dataplane_scenario(self):
"az devcenter dev environment list-operation "
'--name "{envName}" '
'--project "{projectName}" '
'--dev-center "{devcenterName}" ').get_output_in_json()[0]["operationId"]

'--dev-center "{devcenterName}" '
).get_output_in_json()[0]["operationId"]

self.kwargs.update(
{
"operationId": operationId,

}
)

Expand Down Expand Up @@ -2409,7 +2374,7 @@ def test_environment_operations_dataplane_scenario(self):
checks=[
self.check("name", "{actionName}"),
self.check("actionType", "Delete"),
self.check("next.scheduledTime", "{scheduledTime}")
self.check("next.scheduledTime", "{scheduledTime}"),
],
)

Expand All @@ -2426,29 +2391,23 @@ def test_environment_operations_dataplane_scenario(self):
],
)


self.cmd(
"az devcenter dev environment skip-action "
'--name "{envName}" '
'--project "{projectName}" '
'--dev-center "{devcenterName}" '
'--action-name "{actionName}"'
)


def test_dev_box_repair_dataplane_scenario(self):
self.kwargs.update(
{
"location": "centraluseuap",
"devBoxName": self.create_random_name(prefix="cli", length=24),
"rg": self.create_random_name(prefix="cli", length=24)

"rg": self.create_random_name(prefix="cli", length=24),
}
)
self.cmd(
"az group create "
'--location "{location}" '
'--name "{rg}" ')
self.cmd("az group create " '--location "{location}" ' '--name "{rg}" ')
create_dev_box_dependencies(self)
login_account(self)

Expand All @@ -2460,8 +2419,6 @@ def test_dev_box_repair_dataplane_scenario(self):
'--dev-center "{devcenterName}" ',
)



self.cmd(
"az devcenter dev dev-box repair "
'--name "{devBoxName}" '
Expand Down Expand Up @@ -2497,12 +2454,12 @@ def test_dev_box_repair_dataplane_scenario(self):
"az devcenter dev dev-box list-operation "
'--name "{devBoxName}" '
'--project "{projectName}" '
'--dev-center "{devcenterName}" ').get_output_in_json()[0]["operationId"]

'--dev-center "{devcenterName}" '
).get_output_in_json()[0]["operationId"]

self.kwargs.update(
{
"operationId": operationId,

}
)

Expand All @@ -2522,4 +2479,3 @@ def test_dev_box_repair_dataplane_scenario(self):
self.check("status", "Succeeded"),
],
)