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

Extension sequencing scenario #2969

Merged
merged 36 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
656f863
update tests
Oct 18, 2023
5633e53
cleanup
Oct 19, 2023
029f5ae
.
Oct 19, 2023
ae3ad4a
.
Oct 20, 2023
705796d
.
Oct 20, 2023
eb4c490
.
Oct 20, 2023
7dcc600
.
Oct 23, 2023
d49bd31
.
Oct 23, 2023
31b0271
.
Oct 23, 2023
46c9eef
.
Oct 23, 2023
2b9de7f
.
Oct 24, 2023
59b509a
Add new test cases
maddieford Oct 30, 2023
189d1a2
Merge develop
maddieford Oct 30, 2023
a8d77ed
Update scenario to support new tests
maddieford Oct 30, 2023
1574afb
Merge branch 'develop' of github.com:maddieford/WALinuxAgent into dep…
maddieford Oct 30, 2023
b04e06b
Scenario should support failing extensions and extensions with no set…
maddieford Oct 30, 2023
8e522b2
Clean up test
maddieford Oct 31, 2023
9070a5a
Merge branch 'develop' of github.com:maddieford/WALinuxAgent into dep…
maddieford Oct 31, 2023
106f383
Remove locations from test suite yml
maddieford Oct 31, 2023
a37e181
Fix deployment issue
maddieford Oct 31, 2023
4ffa3ee
Support creating multiple resource groups for vmss in one run
maddieford Oct 31, 2023
59691ff
AzureMonitorLinuxAgent is not supported on flatcar
maddieford Oct 31, 2023
fb52b39
Resolve merge conflicts
maddieford Oct 31, 2023
4fd744d
AzureMonitor is not supported on flatcar
maddieford Oct 31, 2023
7f3bb7b
remove agent update
maddieford Oct 31, 2023
2640a7e
Address PR comments
maddieford Nov 1, 2023
ecdb9ad
Fix issue with getting random ssh client
maddieford Nov 1, 2023
7e693a1
Address PR Comments
maddieford Nov 2, 2023
d826622
Address PR Comments
maddieford Nov 2, 2023
0e2ea4f
Address PR comments
maddieford Nov 2, 2023
8cf4d19
Do not keep rg count in runbook
maddieford Nov 2, 2023
6ae88f0
Use try/finally with lock
maddieford Nov 2, 2023
c5e79ae
only check logs after scenario startS
maddieford Nov 7, 2023
a45db9c
Merge branch 'develop' into depenency_tests
maddieford Nov 7, 2023
0c91f6d
Change to instance member
maddieford Nov 7, 2023
c832824
Merge branch 'develop' into depenency_tests
maddieford Nov 7, 2023
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
21 changes: 18 additions & 3 deletions tests_e2e/orchestrator/lib/agent_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ def __init__(self, metadata: TestSuiteMetadata) -> None:
self._create_scale_set: bool
self._delete_scale_set: bool

#
# Test suites within the same runbook may be executed concurrently, and we need to keep track of how many resource
# groups are being created. We use this lock and counter to allow only 1 thread to increment the resource group
# count.
#
_rg_count_lock = RLock()
_rg_count = 0

def _initialize(self, environment: Environment, variables: Dict[str, Any], lisa_working_path: str, lisa_log_path: str, lisa_log: Logger):
"""
Initializes the AgentTestSuite from the data passed as arguments by LISA.
Expand Down Expand Up @@ -231,9 +239,16 @@ def _initialize(self, environment: Environment, variables: Dict[str, Any], lisa_

if isinstance(environment.nodes[0], LocalNode):
# We need to create a new VMSS.
# Use the same naming convention as LISA for the scale set name: lisa-<runbook name>-<run id>-e0-n0. Note that we hardcode the resource group
# id to "e0" and the scale set name to "n0" since we are creating a single scale set.
self._resource_group_name = f"lisa-{self._runbook_name}-{RUN_ID}-e0"
# Use the same naming convention as LISA for the scale set name: lisa-<runbook name>-<run id>-e<rg count>-n0
# Note that we hardcode the scale set name to "n0" since we are creating a single scale set.
# Resource group name cannot have any uppercase characters, because the publicIP cannot have uppercase
# characters in its domain name label.
AgentTestSuite._rg_count_lock.acquire()
try:
self._resource_group_name = f"lisa-{self._runbook_name.lower()}-{RUN_ID}-e{AgentTestSuite._rg_count}"
AgentTestSuite._rg_count += 1
finally:
AgentTestSuite._rg_count_lock.release()
self._vmss_name = f"{self._resource_group_name}-n0"
self._test_nodes = [] # we'll fill this up when the scale set is created
self._create_scale_set = True
Expand Down
2 changes: 1 addition & 1 deletion tests_e2e/orchestrator/runbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ variable:
# Test suites to execute
#
- name: test_suites
value: "agent_bvt, no_outbound_connections, extensions_disabled, agent_not_provisioned, fips, agent_ext_workflow, agent_status, multi_config_ext, agent_cgroups, ext_cgroups, agent_firewall, ext_telemetry_pipeline"
value: "agent_bvt, no_outbound_connections, extensions_disabled, agent_not_provisioned, fips, agent_ext_workflow, agent_status, multi_config_ext, agent_cgroups, ext_cgroups, agent_firewall, ext_telemetry_pipeline, ext_sequencing"

#
# Parameters used to create test VMs
Expand Down
10 changes: 10 additions & 0 deletions tests_e2e/test_suites/ext_sequencing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Adds extensions with multiple dependencies to VMSS using 'provisionAfterExtensions' property and validates they are
# enabled in order of dependencies.
#
name: "ExtSequencing"
tests:
- "ext_sequencing/ext_sequencing.py"
images: "endorsed"
# This scenario is executed on instances of a scaleset created by the agent test suite.
executes_on_scale_set: true
318 changes: 318 additions & 0 deletions tests_e2e/tests/ext_sequencing/ext_seq_test_cases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,318 @@
def add_one_dependent_ext_without_settings():
# Dependent extensions without settings should be enabled with dependencies
narrieta marked this conversation as resolved.
Show resolved Hide resolved
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"provisionAfterExtensions": ["CustomScript"],
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True
}
},
{
"name": "CustomScript",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
}
]


def add_two_extensions_with_dependencies():
# Checks that extensions are enabled in the correct order when there is only one valid sequence
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"provisionAfterExtensions": [],
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True
}
},
{
"name": "RunCommandLinux",
"properties": {
"provisionAfterExtensions": ["AzureMonitorLinuxAgent"],
"publisher": "Microsoft.CPlat.Core",
"type": "RunCommandLinux",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
},
{
"name": "CustomScript",
"properties": {
"provisionAfterExtensions": ["RunCommandLinux", "AzureMonitorLinuxAgent"],
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
}
]


def remove_one_dependent_extension():
narrieta marked this conversation as resolved.
Show resolved Hide resolved
# Checks that remaining extensions with dependencies are enabled in the correct order after removing a dependent
# extension
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True
}
},
{
"name": "CustomScript",
"properties": {
"provisionAfterExtensions": ["AzureMonitorLinuxAgent"],
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
}
]


def remove_all_dependencies():
# Checks that extensions are enabled after adding and removing dependencies
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True
}
},
{
"name": "RunCommandLinux",
"properties": {
"publisher": "Microsoft.CPlat.Core",
"type": "RunCommandLinux",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
},
{
"name": "CustomScript",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
}
]


def add_one_dependent_extension():
# Checks that a valid enable sequence occurs when only one extension has dependencies
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"provisionAfterExtensions": ["RunCommandLinux", "CustomScript"],
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True
}
},
{
"name": "RunCommandLinux",
"properties": {
"publisher": "Microsoft.CPlat.Core",
"type": "RunCommandLinux",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
},
{
"name": "CustomScript",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
}
]


def add_single_dependencies():
# Checks that extensions are enabled in the correct order when there is only one valid sequence and each extension
# has no more than one dependency
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"provisionAfterExtensions": [],
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True
}
},
{
"name": "RunCommandLinux",
"properties": {
"provisionAfterExtensions": ["CustomScript"],
"publisher": "Microsoft.CPlat.Core",
"type": "RunCommandLinux",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
},
{
"name": "CustomScript",
"properties": {
"provisionAfterExtensions": ["AzureMonitorLinuxAgent"],
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
}
]


def remove_all_dependent_extensions():
# Checks that remaining extensions with dependencies are enabled in the correct order after removing all dependent
# extension
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True
}
}
]


def add_failing_dependent_extension_with_one_dependency():
# This case tests that extensions dependent on a failing extensions are skipped, but extensions that are not
# dependent on the failing extension still get enabled
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"provisionAfterExtensions": ["CustomScript"],
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True,
"settings": {}
}
},
{
"name": "RunCommandLinux",
"properties": {
"publisher": "Microsoft.CPlat.Core",
"type": "RunCommandLinux",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
},
{
"name": "CustomScript",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "exit 1"
}
}
}
]


def add_failing_dependent_extension_with_two_dependencies():
# This case tests that all extensions dependent on a failing extensions are skipped
return [
{
"name": "AzureMonitorLinuxAgent",
"properties": {
"provisionAfterExtensions": ["CustomScript"],
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"typeHandlerVersion": "1.5",
"autoUpgradeMinorVersion": True
}
},
{
"name": "RunCommandLinux",
"properties": {
"provisionAfterExtensions": ["CustomScript"],
"publisher": "Microsoft.CPlat.Core",
"type": "RunCommandLinux",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "date"
}
}
},
{
"name": "CustomScript",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.1",
"autoUpgradeMinorVersion": True,
"settings": {
"commandToExecute": "exit 1"
}
}
}
]
Loading
Loading