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

Fix flaky test test_e2e_conduit_ephermal

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • 2025-04-16 - API
    • None
    • None
    • None
    • 5
    • False
    • Hide

      None

      Show
      None
    • False

      Test:

      application = <iqe.base.application.Application object at 0x7f5165d315b0>
      
          @pytest.mark.ephemeral
          @pytest.mark.ephemeral_only
          def test_e2e_conduit_ephermal(application):
              """Validate Conduit ephemeral service.
              metadata:
                  assignee: aunayak
                  negative: false
                  test_steps:
                      1. Read existing consumer data
                      2. Sync conduit data for account.
                      3. Sync Tally for account.
                      4. Verify RHEL Hosts.
                      5. Verify Hypervisors and guests.
                      6. Verify OCP Clusters
                  expected_results:
                      1. After Conduit/tally sync data is present in HBI and system table.
              """
              candlepin_consumers = application.rhsm_subscriptions.list_systems_in_candlepin()
              if not candlepin_consumers:
                  pytest.skip("No Consumers found in candlepin")
              filtered_consumers = []
              check_openshift = None
              check_hyper = None
              check_rhel = None
              # Filtering hosts for t-1 days to be sure they would be synced
              for consumers in candlepin_consumers:
                  if parse(consumers.get("lastCheckin")) > datetime.datetime.now(
                      datetime.timezone.utc
                  ) - timedelta(days=1):
                      filtered_consumers.append(consumers)
                      if "openshift_cores" in consumers["name"]:
                          logging.info(f"Openshift consumers present in candlepin - {consumers['name']}")
                          check_openshift = True
                      elif "Hypervisor" in consumers["type"]:
                          logging.info(f"Hypervisors present in candlepin - {consumers['name']}")
                          check_hyper = True
                      elif "physical" in consumers["name"]:
                          logging.info(f"Physical RHEL present in candlepin - {consumers['name']}")
                          check_rhel = True
          
              # Conduit Sync
              application.rhsm_subscriptions.sync_conduit(wait=True, timeout_tries=4)
              # Get all hosts from HBI
              host_list = application.rhsm_subscriptions.get_all_host_inventory()
      >       assert host_list, "Stale Hosts in Candlepin, Couldn't Sync to HBI."
      E       AssertionError: Stale Hosts in Candlepin, Couldn't Sync to HBI.
      E       assert []
      

      Output:

      --------------------------------- Captured Log ---------------------------------
      2025-03-12 08:29:44 INFO Setting auth_type to identity
      2025-03-12 08:29:44 INFO Created RESTPluginService client for http://swatch-api-service.ephemeral-t3temf.svc:8000/api/rhsm-subscriptions with the following attributes: ['capacity_api', 'client', 'instances_api', 'opt_in_api', 'package', 'root_api', 'subscriptions_api', 'tally_api', 'version_api']
      2025-03-12 08:29:44 INFO REST: PUT http://swatch-api-service.ephemeral-t3temf.svc:8000/api/rhsm-subscriptions/v1/opt-in with query params [] and x-rh-insights-request-id=None
      2025-03-12 08:29:45 INFO Setting auth_type to identity
      2025-03-12 08:29:45 INFO Created RESTPluginService client for http://host-inventory-service.ephemeral-t3temf.svc:8000/api/inventory/v1 with the following attributes: ['accounts_staleness_api', 'client', 'groups_api', 'hosts_api', 'package', 'resource_types_api', 'system_profile_api', 'tags_api']
      2025-03-12 08:29:45 INFO REST: GET http://host-inventory-service.ephemeral-t3temf.svc:8000/api/inventory/v1/hosts with query params [] and x-rh-insights-request-id=None
      2025-03-12 08:29:45 INFO Total Hosts in inventory: 0
      2025-03-12 08:29:45 INFO POST request response url: http://swatch-system-conduit-service:8000/api/rhsm-subscriptions/v1/internal/rpc/syncOrg, status_code: 200
      2025-03-12 08:29:45 INFO Trace log using : 00-7b984e0192c38221d5f63c5f15bb7117-b1ed00f23acd6208-00  
      2025-03-12 08:29:45 INFO REST: GET http://host-inventory-service.ephemeral-t3temf.svc:8000/api/inventory/v1/hosts with query params [] and x-rh-insights-request-id=None
      2025-03-12 08:29:45 INFO Total Hosts in inventory: 0
      2025-03-12 08:29:45 INFO Waiting for conduit sync completion...
      2025-03-12 08:29:50 INFO REST: GET http://host-inventory-service.ephemeral-t3temf.svc:8000/api/inventory/v1/hosts with query params [] and x-rh-insights-request-id=None
      2025-03-12 08:29:50 INFO Total Hosts in inventory: 0
      2025-03-12 08:29:50 INFO Waiting for conduit sync completion...
      2025-03-12 08:29:55 INFO REST: GET http://host-inventory-service.ephemeral-t3temf.svc:8000/api/inventory/v1/hosts with query params [] and x-rh-insights-request-id=None
      2025-03-12 08:29:55 INFO Total Hosts in inventory: 0
      2025-03-12 08:29:55 INFO Waiting for conduit sync completion...
      2025-03-12 08:30:00 INFO REST: GET http://host-inventory-service.ephemeral-t3temf.svc:8000/api/inventory/v1/hosts with query params [] and x-rh-insights-request-id=None
      2025-03-12 08:30:00 INFO Total Hosts in inventory: 0
      2025-03-12 08:30:00 INFO Waiting for conduit sync completion...
      2025-03-12 08:30:05 INFO REST: GET http://host-inventory-service.ephemeral-t3temf.svc:8000/api/inventory/v1/hosts with query params [] and x-rh-insights-request-id=None
      2025-03-12 08:30:05 INFO Total Hosts in inventory: 0
      2025-03-12 08:30:05 INFO REST: GET http://host-inventory-service.ephemeral-t3temf.svc:8000/api/inventory/v1/hosts with query params [('page', 1)] and x-rh-insights-request-id=None
      --------------------------------- Captured Out ---------------------------------
      

      Example: https://ci.ext.devshift.net/job/RedHatInsights-rhsm-subscriptions-pr-check/9995/

              rhn-engineering-wpoteat William Poteat
              jcarvaja@redhat.com Jose Carvajal Hilario
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: