Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-4080

test_capacity_e2e.py::test_validate_capacity_daily_on_rhel

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Critical Critical
    • 2025-11-04 - API Released
    • None
    • None
    • None

      https://reportportal-smqe.apps.dno.ocp-hub.prod.psi.redhat.com/ui/#subscription_watch/launches/all/347065/28748218/log?item0Params=filter.eq.hasStats%3Dtrue%26filter.eq.hasChildren%3Dfalse%26filter.in.type%3DSTEP%26filter.in.status%3DFAILED

       

      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://mtls.internal.cloud.stage.redhat.com/api/swatch-contracts/internal/subscriptions/sync/org/18939578
      
      /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 

              jcarvaja@redhat.com Jose Carvajal Hilario
              lburnett0 Lindsey Burnett
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: