From b440696429f2adba5b64270e7511dba1dcca89f7 Mon Sep 17 00:00:00 2001 From: mgunnala Date: Mon, 11 Nov 2024 12:38:33 -0500 Subject: [PATCH] Fix e2e test failures --- tests_e2e/test_suites/ext_policy_with_dependencies.yml | 5 ++++- tests_e2e/tests/ext_policy/ext_policy_with_dependencies.py | 2 +- .../scripts/agent_ext_workflow-check_data_in_agent_log.py | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests_e2e/test_suites/ext_policy_with_dependencies.yml b/tests_e2e/test_suites/ext_policy_with_dependencies.yml index 3a460c5317..15522cd1d0 100644 --- a/tests_e2e/test_suites/ext_policy_with_dependencies.yml +++ b/tests_e2e/test_suites/ext_policy_with_dependencies.yml @@ -5,4 +5,7 @@ name: "ExtPolicyWithDependencies" tests: - "ext_policy/ext_policy_with_dependencies.py" images: "random(endorsed)" -executes_on_scale_set: true \ No newline at end of file +executes_on_scale_set: true +# This test should run on its own VMSS, because other tests may leave behind extensions +# that are disallowed by policy and affect results. +owns_vm: true \ No newline at end of file diff --git a/tests_e2e/tests/ext_policy/ext_policy_with_dependencies.py b/tests_e2e/tests/ext_policy/ext_policy_with_dependencies.py index ae8cf1e966..ba3f908521 100644 --- a/tests_e2e/tests/ext_policy/ext_policy_with_dependencies.py +++ b/tests_e2e/tests/ext_policy/ext_policy_with_dependencies.py @@ -141,7 +141,7 @@ def run(self): # Copy policy file to each instance log.info("Updating policy file with new policy: {0}".format(policy)) - for instance_name, ssh_client in ssh_clients.items(): + for ssh_client in ssh_clients.values(): self._create_policy_file(ssh_client, policy) # Deploy updated extension template to the scale set. diff --git a/tests_e2e/tests/scripts/agent_ext_workflow-check_data_in_agent_log.py b/tests_e2e/tests/scripts/agent_ext_workflow-check_data_in_agent_log.py index 5bab40b8dc..03155cb44c 100755 --- a/tests_e2e/tests/scripts/agent_ext_workflow-check_data_in_agent_log.py +++ b/tests_e2e/tests/scripts/agent_ext_workflow-check_data_in_agent_log.py @@ -36,8 +36,11 @@ def main(): found = False try: - after_timestamp = (datetime.strptime(args.after_timestamp, '%Y-%m-%d %H:%M:%S') if args.after_timestamp else None) - found = AgentLog(Path('/var/log/waagent.log')).agent_log_contains(args.data, after_timestamp) + if args.after_timestamp is not None: + after_datetime = datetime.strptime(args.after_timestamp, '%Y-%m-%d %H:%M:%S') + found = AgentLog(Path('/var/log/waagent.log')).agent_log_contains(args.data, after_datetime) + else: + found = AgentLog(Path('/var/log/waagent.log')).agent_log_contains(args.data) if found: print("Found data: {0} in agent log".format(args.data)) else: