-
Notifications
You must be signed in to change notification settings - Fork 372
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
fix the ignore rule in agent update test #2915
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
# For each scenario, we initiate the rsm request with target version and then verify agent updated to that target version. | ||
# | ||
import json | ||
import re | ||
from typing import List, Dict, Any | ||
|
||
import requests | ||
|
@@ -49,16 +50,17 @@ def __init__(self, context: AgentTestContext): | |
ip_address=self._context.vm_ip_address, | ||
username=self._context.username, | ||
private_key_file=self._context.private_key_file) | ||
self._installed_agent_version = "9.9.9.9" | ||
|
||
def get_ignore_error_rules(self) -> List[Dict[str, Any]]: | ||
ignore_rules = [ | ||
# | ||
# This is expected as we validate the downgrade scenario | ||
# | ||
# WARNING ExtHandler ExtHandler Agent WALinuxAgent-9.9.9.9 is permanently blacklisted | ||
# | ||
# Note: Version varies depending on the pipeline branch the test is running on | ||
{ | ||
'message': r"Agent WALinuxAgent-9.9.9.9 is permanently blacklisted" | ||
'message': rf"Agent WALinuxAgent-{self._installed_agent_version} is permanently blacklisted" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why using the version of the installed agent? shouldn't it be the version that your test uses for the downgrade? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, we blacklist the current version which is running not the downloaded version. we use different versions for downgrade and upgrade sceanrio There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, but 9.9.9.9 was blacklisted only because it was > than the version you were upgrading/downgrading to, right? shouldn't this rule be added conditionally, only if installed version > your test version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right, let me add that |
||
}, | ||
# We don't allow downgrades below then daemon version | ||
# 2023-07-11T02:28:21.249836Z WARNING ExtHandler ExtHandler [AgentUpdateError] The Agent received a request to downgrade to version 1.4.0.0, but downgrading to a version less than the Agent installed on the image (1.4.0.1) is not supported. Skipping downgrade. | ||
|
@@ -71,6 +73,8 @@ def get_ignore_error_rules(self) -> List[Dict[str, Any]]: | |
return ignore_rules | ||
|
||
def run(self) -> None: | ||
# retrieve the installed agent version in the vm before run the scenario | ||
self._retrieve_installed_agent_version() | ||
# Allow agent to send supported feature flag | ||
self._verify_agent_reported_supported_feature_flag() | ||
|
||
|
@@ -241,6 +245,17 @@ def _verify_agent_reported_update_status(self, version: str): | |
self._ssh_client.run_command(f"agent_update-verify_agent_reported_update_status.py --version {version}", use_sudo=True) | ||
log.info("Successfully Agent reported update status for version {0}".format(version)) | ||
|
||
def _retrieve_installed_agent_version(self): | ||
""" | ||
Retrieve the installed agent version | ||
""" | ||
log.info("Retrieving installed agent version") | ||
stdout: str = self._ssh_client.run_command("waagent-version", use_sudo=True) | ||
log.info("Retrieved installed agent version \n {0}".format(stdout)) | ||
match = re.search(r'.*Goal state agent: (\S*)', stdout) | ||
if match: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no match should be an error instead of defaulting to 9.9.9.9, shouldn't it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even we raise an error, we still check ignore rules. Need default value either case but that won't change behavior and makes if condition false, so rule won't apply. But I'll raise error There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or at least a warning, rather than silently default to 9.9.9.9 |
||
self._installed_agent_version = match.groups()[0] | ||
|
||
|
||
if __name__ == "__main__": | ||
RsmUpdateBvt.run_from_command_line() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code would be simpler and clearer if you move the call to self._check_agent_log() into execute_test_suite().
As test are executed, we can collect the ignore rules into an array and then just pass them as argument to check_agent_log()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let me work on it