Skip to content

Commit

Permalink
Add fixes for e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgunnala committed Dec 17, 2024
1 parent daa8017 commit bacc425
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests_e2e/tests/ext_policy/ext_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ def run(self):
# RunCommandHandler is a multi-config extension, so we set up two instances (configurations) here and test both.
run_command = ExtPolicy.TestCase(
VirtualMachineRunCommandClient(self._context.vm, VmExtensionIds.RunCommandHandler,
resource_name="RunCommandHandler"),
resource_name="RunCommandHandlerPolicy"),
{'source': f"echo '{str(uuid.uuid4())}'"}
)
run_command_2 = ExtPolicy.TestCase(
VirtualMachineRunCommandClient(self._context.vm, VmExtensionIds.RunCommandHandler,
resource_name="RunCommandHandler2"),
resource_name="RunCommandHandlerPolicy2"),
{'source': f"echo '{str(uuid.uuid4())}'"}
)

Expand All @@ -168,10 +168,8 @@ def run(self):

# Another e2e test may have left behind an extension we want to test here. Cleanup any leftovers so that they
# do not affect the test results.
extensions_to_test = [custom_script, run_command, run_command_2, azure_monitor]
log.info("Cleaning up existing extensions on the test VM [%s]", self._context.vm.name)
for ext_case in extensions_to_test:
ext_case.extension.delete()
self._context.vm.delete_all_extensions()

# Enable policy via conf file
log.info("Enabling policy via conf file on the test VM [%s]", self._context.vm.name)
Expand Down Expand Up @@ -265,12 +263,11 @@ def run(self):
self._operation_should_succeed("delete", custom_script)
self._operation_should_succeed("enable", custom_script)

# Cleanup after test: disable policy enforcement in conf file, and delete any leftover extensions.
# Cleanup after test: delete leftover extensions and disable policy enforcement in conf file.
self._operation_should_succeed("delete", custom_script)
log.info("Disabling policy via conf file on the test VM [%s]", self._context.vm.name)
self._ssh_client.run_command("update-waagent-conf Debug.EnableExtensionPolicy=n", use_sudo=True)
log.info("Test completed. Cleaning up leftover extensions on the test VM [%s]", self._context.vm.name)
for ext_case in extensions_to_test:
ext_case.extension.delete()



def get_ignore_error_rules(self) -> List[Dict[str, Any]]:
Expand Down

0 comments on commit bacc425

Please sign in to comment.