-
Notifications
You must be signed in to change notification settings - Fork 115
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
eol version check #13253
eol version check #13253
Conversation
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.
Conceptually LGTM
if result.status_code != 200: | ||
raise requests.HTTPError(f'{settings.subscription.lifecycle_api_url} is not accessible') | ||
versions = result.json()['data'][0]['versions'] | ||
version = [v for v in versions if v['name'] == current_version] |
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.
version = [v for v in versions if v['name'] == current_version] | |
version = [v for v in versions if v['name'] == current_version][0] |
tests/foreman/api/test_eol_banner.py
Outdated
version = [v for v in versions if v['name'] == current_version] | ||
api_date = [ | ||
(p['date_format'], p['date']) | ||
for p in version[0]['phases'] |
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.
for p in version[0]['phases'] | |
for p in version['phases'] |
tests/foreman/api/test_eol_banner.py
Outdated
(p['date_format'], p['date']) | ||
for p in version[0]['phases'] | ||
if p['name'] == 'Maintenance support' | ||
] |
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.
] | |
][0] |
tests/foreman/api/test_eol_banner.py
Outdated
for p in version[0]['phases'] | ||
if p['name'] == 'Maintenance support' | ||
] | ||
if api_date[0][0] == 'string': |
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.
if api_date[0][0] == 'string': | |
if api_date[0] == 'string': |
tests/foreman/api/test_eol_banner.py
Outdated
] | ||
if api_date[0][0] == 'string': | ||
assert eol_datetime.strftime("%B, %Y") in api_date[0][1] | ||
if api_date[0][0] == 'date': |
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.
if api_date[0][0] == 'date': | |
if api_date[0] == 'date': |
tests/foreman/api/test_eol_banner.py
Outdated
""" | ||
current_version = '.'.join(target_sat.version.split('.')[0:2]) | ||
output = yaml.load(target_sat.execute(rf'cat {LIFECYCLE_METADATA_FILE}').stdout, yaml.Loader) | ||
eol_datetime = datetime.strptime(output['releases'][current_version]['end_of_life'], '%Y-%m-%y') |
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.
eol_datetime = datetime.strptime(output['releases'][current_version]['end_of_life'], '%Y-%m-%y') | |
eol_datetime = datetime.strptime(output['releases'][current_version]['end_of_life'], '%Y-%m-%d') |
tests/foreman/api/test_eol_banner.py
Outdated
if p['name'] == 'Maintenance support' | ||
] | ||
if api_date[0][0] == 'string': | ||
assert eol_datetime.strftime("%B, %Y") in api_date[0][1] |
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.
- Why is the comparison only accurate to a month?
- Can't we test for equality?
This pull request has not been updated in the past 45 days. |
@pondrejk can you please work on the review comments as the PR is getting stale status |
This pull request has not been updated in the past 45 days. |
This pull request has not been updated in the past 45 days. |
This pull request is now being closed after stale warnings. |
c4aa858
to
2c08a8e
Compare
2c08a8e
to
4bc63f9
Compare
4bc63f9
to
06693a4
Compare
@lhellebr & reviewers, thanks for the patience, I applied the feedback. This PR requires satelliteqe-jenkins mr !1335 to be in. I'm assuming that released sat versions will be present in the lifecycle api, which might be considered naive, but I didn't find a sure way to establish which versions are published just from our configs, hope this makes sense |
06693a4
to
7bb97a2
Compare
trigger: test-robottelo |
PRT Result
|
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.
I believe there are some serious flaws in the assertion logic that might lead to false-negative test results in some scenarios.
tests/foreman/api/test_eol_banner.py
Outdated
if result.status_code != 200: | ||
raise requests.HTTPError(f'{settings.subscription.lifecycle_api_url} is not accessible') |
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.
if result.status_code != 200: | |
raise requests.HTTPError(f'{settings.subscription.lifecycle_api_url} is not accessible') | |
result.raise_for_status() |
https://docs.python-requests.org/en/latest/api/#requests.Response.raise_for_status
7bb97a2
to
f0bb466
Compare
trigger: test-robottelo |
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.
One more unhandled else
f0bb466
to
f49f106
Compare
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.
LGTM
(cherry picked from commit e65bda0)
(cherry picked from commit e65bda0)
Problem Statement
This supplements tests for the EOL banner feature. The eol date for the version is defined in the satellite-lifecycle package (so that there is the same solution for connected and disconnected sats). This test aims to check the date in the package is correctly updated.
Solution
Comparing the date from the package with the date from the lifecycle api.
Keeping in draft state, as the EOL banner just got to 6.15, but not yet to older releases and the lifecycle api contains data only for released versions
Related Issues
satellite-jenkins MR 1185