From 841ee1ddb1e3c7c2d90a6e3461c3802e5c0dbd90 Mon Sep 17 00:00:00 2001 From: Norberto Arrieta Date: Wed, 24 May 2023 16:08:59 -0700 Subject: [PATCH] Fixes for end-to-end tests (#2827) Co-authored-by: narrieta --- tests_e2e/orchestrator/lib/agent_test_suite.py | 2 +- tests_e2e/orchestrator/scripts/install-agent | 13 +++++++++---- tests_e2e/tests/lib/agent_log.py | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests_e2e/orchestrator/lib/agent_test_suite.py b/tests_e2e/orchestrator/lib/agent_test_suite.py index 2e84c59a3f..98dd58583a 100644 --- a/tests_e2e/orchestrator/lib/agent_test_suite.py +++ b/tests_e2e/orchestrator/lib/agent_test_suite.py @@ -349,7 +349,7 @@ def _setup_node(self) -> None: # log.info('Installing tools on the test node') command = f"tar xf {target_path/tarball_path.name} && ~/bin/install-tools" - log.info("%s\n%s", command, self.context.ssh_client.run_command(command)) + log.info("Remote command [%s] completed:\n%s", command, self.context.ssh_client.run_command(command)) if self.context.is_vhd: log.info("Using a VHD; will not install the Test Agent.") diff --git a/tests_e2e/orchestrator/scripts/install-agent b/tests_e2e/orchestrator/scripts/install-agent index 513487b211..e7f78cb349 100755 --- a/tests_e2e/orchestrator/scripts/install-agent +++ b/tests_e2e/orchestrator/scripts/install-agent @@ -77,18 +77,18 @@ fi python=$(get-agent-python) waagent=$(get-agent-bin-path) -echo "============================================================" +echo "========== Initial Status ==========" echo "Service Name: $service_name" echo "Agent Path: $waagent" echo "Agent Version:" $python "$waagent" --version echo "Service Status:" service-status $service_name -echo "============================================================" # # Install the package # +echo "========== Installing Agent ==========" echo "Installing $package as version $version..." unzip.py "$package" "/var/lib/waagent/WALinuxAgent-$version" @@ -116,7 +116,8 @@ service-start $service_name echo "Verifying agent installation..." check-version() { - for i in {0..5} + # We need to wait for the extension handler to start, give it a couple of minutes + for i in {1..12} do if $python "$waagent" --version | grep -E "Goal state agent:\s+$version" > /dev/null; then return 0 @@ -131,10 +132,14 @@ if check-version "$version"; then printf "\nThe agent was installed successfully\n" exit_code=0 else - printf "\nFailed to install agent.\n" + printf "************************************\n" + printf " * ERROR: Failed to install agent. *\n" + printf "************************************\n" exit_code=1 fi +printf "\n" +echo "========== Final Status ==========" $python "$waagent" --version printf "\n" service-status $service_name diff --git a/tests_e2e/tests/lib/agent_log.py b/tests_e2e/tests/lib/agent_log.py index 657b729282..e958d34d54 100644 --- a/tests_e2e/tests/lib/agent_log.py +++ b/tests_e2e/tests/lib/agent_log.py @@ -393,7 +393,7 @@ def matches_ignore_rule(record: AgentLogRecord, ignore_rules: List[Dict[str, Any # Extension: 2021/03/30 19:45:31 Azure Monitoring Agent for Linux started to handle. # 2021/03/30 19:45:31 [Microsoft.Azure.Monitor.AzureMonitorLinuxAgent-1.7.0] cwd is /var/lib/waagent/Microsoft.Azure.Monitor.AzureMonitorLinuxAgent-1.7.0 # - _NEWER_AGENT_RECORD = re.compile(r'(?P[\d-]+T[\d:.]+Z)\s(?PVERBOSE|INFO|WARNING|ERROR)\s(?P\S+)\s(?P(Daemon)|(ExtHandler)|(\[\S+\]))\s(?P.*)') + _NEWER_AGENT_RECORD = re.compile(r'(?P[\d-]+T[\d:.]+Z)\s(?PVERBOSE|INFO|WARNING|ERROR)\s(?P\S+)\s(?P(Daemon)|(ExtHandler)|(LogCollector)|(\[\S+\]))\s(?P.*)') _2_2_46_AGENT_RECORD = re.compile(r'(?P[\d-]+T[\d:.]+Z)\s(?PVERBOSE|INFO|WARNING|ERROR)\s(?P)(?PDaemon|ExtHandler|\[\S+\])\s(?P.*)') _OLDER_AGENT_RECORD = re.compile(r'(?P[\d/]+\s[\d:.]+)\s(?PVERBOSE|INFO|WARNING|ERROR)\s(?P)(?P\S*)\s(?P.*)') _EXTENSION_RECORD = re.compile(r'(?P[\d/]+\s[\d:.]+)\s(?P)(?P)((?P\[[^\]]+\])\s)?(?P.*)')