application = <iqe.base.application.Application object at 0x7fed72153f80>
@pytest.mark.post_stage_deploy
def test_validate_capacity_daily_on_rhel(application):
"""Validate capacity data with API response for RHEL.
metadata:
assignee: tmcknigh
negative: false
bugzilla: 1795361
customer_scenario: true
test_steps:
1. Read existing capacity data.
2. Increase subscription capacity with RH00004 sku for account
starting a day before.
3. Sync Capacity data for account.
4. Read new capacity data.
5. Verify capacity data shows increased count for today.
6. Verify capacity not changed for previous days.
expected_results:
1. Capacity data shown is correct.
"""
last_day = today() - datedelta.DAY
rhel_capacity_initial_daily_usage = {
"sockets": application.rhsm_subscriptions.get_capacity_report(
product_id="RHEL for x86",
beginning=datetime_to_iso8601_format(last_day),
ending=datetime_to_iso8601_format(today()),
granularity="Daily",
metric_id="Sockets",
),
"physical_sockets": application.rhsm_subscriptions.get_capacity_report(
product_id="RHEL for x86",
beginning=datetime_to_iso8601_format(last_day),
ending=datetime_to_iso8601_format(today()),
granularity="Daily",
metric_id="Sockets",
category="physical",
),
}
> subscription = application.rhsm_subscriptions.add_sku(
sku="RH00004",
start=last_day.strftime("%Y-%m-%d"),
quantity=5,
count=1,
wait=True,
product_id="RHEL for x86",
)
/iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/tests/integration/swatch_subscriptions/test_capacity_e2e.py:113:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/__init__.py:523: in add_sku
self.sync_capacity(product_id=product_id)
/iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/__init__.py:1344: in sync_capacity
self.application.rhsm_subscriptions.rhsm_internal_api.contracts.sync_capacity_for_org(
/iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/internal_apis/swatch_contracts.py:353: in sync_capacity_for_org
self.call(
/iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/internal_apis/__init__.py:197: in call
response.raise_for_status()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Response [504]>
def raise_for_status(self):
"""Raises :class:`HTTPError`, if one occurred."""
http_error_msg = ""
if isinstance(self.reason, bytes):
# We attempt to decode utf-8 first because some servers
# choose to localize their reason strings. If the string
# isn't utf-8, we fall back to iso-8859-1 for all other
# encodings. (See PR #3538)
try:
reason = self.reason.decode("utf-8")
except UnicodeDecodeError:
reason = self.reason.decode("iso-8859-1")
else:
reason = self.reason
if 400 <= self.status_code < 500:
http_error_msg = (
f"{self.status_code} Client Error: {reason} for url: {self.url}"
)
elif 500 <= self.status_code < 600:
http_error_msg = (
f"{self.status_code} Server Error: {reason} for url: {self.url}"
)
if http_error_msg:
> raise HTTPError(http_error_msg, response=self)
E requests.exceptions.HTTPError: 504 Server Error: Gateway Time-out for url: https:
/iqe_venv/lib/python3.12/site-packages/requests/models.py:1026: HTTPError2025-10-07 17:21:52Jump ToFork us on GitHubChat with us on SlackContact usEPAM