-
Bug
-
Resolution: Done
-
Critical
-
None
-
None
-
None
-
5
-
False
-
-
True
-
subs-swatch
-
-
Test:
application = <iqe.base.application.Application object at 0x7f5c47421400> tally_db_session = <sqlalchemy.orm.session.Session object at 0x7f5c45e41c40> billing_provider = 'aws' @pytest.mark.ephemeral @pytest.mark.ephemeral_only @pytest.mark.parametrize("billing_provider", ["aws", "azure"]) def test_succeeded_billable_usage_not_updated_to_failed( application, tally_db_session, billing_provider ): """ metadata: assignee: kflahert negative: true importance: high bugzilla: SWATCH-3380 requirements: payg_tally test_steps: 1. Tally Summary -> Billable Usage -> Billable Usage Aggregate -> Status: Success 2. Billable Usage Aggregate is consumed again and returns a failed status expected_results: 1. Remittance should remain in succeeded status """ # SET UP product_id = "rhel-for-x86-els-payg-addon" billing_account_id = str(uuid.uuid4()) metric = config_parser.get_swatch_metric_id_from_tag_metrics(product_id=product_id)[0] data = { "billing_provider": billing_provider, "billing_account_id": billing_account_id, metric.lower(): 1, } hours = get_random_number_from_range_or_minimum(1, 5) application.rhsm_subscriptions.reset_account() # Step 1. Tally Summary -> Billable Usage -> Billable Usage Aggregate -> Status: Failed due to subscription_not_found. logging.info(f"Creating event with data: {data}") event_start_time = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(hours=12) cluster_event_1 = _create_events( product_id=product_id, org_id=application.user.identity.org_id, hours=hours, instance_uuid="test-cluster-uuid", billing_account_id=billing_account_id, billing_provider=billing_provider, start_time=event_start_time, ) cluster_event_value_1 = cluster_event_1[0]["measurements"][0]["value"] * hours application.rhsm_subscriptions.rhsm_internal_api.tally.wait_for_save_events( events=cluster_event_1 ) # Step 2. Add a subscription/contract if billing_provider == "azure": create_azure_usage_context_wiremock( application, billing_account_id, metric.lower(), cluster_event_value_1 ) contract_data = { "instance_hours": hours, "cores": 1, "billing_provider": billing_provider, "billing_account_id": billing_account_id, } application.rhsm_subscriptions.create_contract( product_id=product_id, **contract_data, ) else: application.rhsm_subscriptions.create_mock_subscription( product_id=product_id, billing_provider=billing_provider, billing_account_id=billing_account_id, ) > application.rhsm_subscriptions.sync_tally_hourly( product_id=product_id, billing_provider=billing_provider, billing_account_id=billing_account_id, wait=True, # we're using a random billing account ID, so we expect to always be zero pre_tally=0, # minus two hours to ensure that tally captures the just created event from above start=(event_start_time - datetime.timedelta(hours=1)).strftime("%Y-%m-%dT%H:%M:%SZ"), perform_metering=False, metric_id=metric, wait_for_remittance=True, expected_remittance_status="succeeded", ) /iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/tests/integration/swatch_billing/test_remitance.py:1536: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/__init__.py:929: in sync_tally_hourly self._assert_sync_tally_hourly_timout( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ApplicationRhsmSubscriptions(config=<iqe.base.settings.VaultLoaderAwareSetting object at 0x7f5c6b575010>) pre_tally_value = 1, post_tally_value = 1, expected_tally_increase = True def _assert_sync_tally_hourly_timout( self, pre_tally_value: float, post_tally_value: float, expected_tally_increase: float ) -> None: if expected_tally_increase: > assert False, ( f"Timeout reached before tally sync completion. " f"Expected tally value was to be higher than {pre_tally_value}, but was {post_tally_value}" ) E AssertionError: Timeout reached before tally sync completion. Expected tally value was to be higher than 1, but was 1 E assert False /iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/__init__.py:948: AssertionError
Output:
--------------------------------- Captured Log --------------------------------- 2025-06-27 02:02:39 INFO Using random seed value for random generation: 7223 2025-06-27 02:02:39 INFO select version() 2025-06-27 02:02:39 INFO [raw sql] {} 2025-06-27 02:02:39 INFO select current_schema() 2025-06-27 02:02:39 INFO [raw sql] {} 2025-06-27 02:02:39 INFO show standard_conforming_strings 2025-06-27 02:02:39 INFO [raw sql] {} 2025-06-27 02:02:39 INFO BEGIN (implicit) 2025-06-27 02:02:39 INFO Flushing usage messages off from billable usage kafka topic 2025-06-27 02:02:39 INFO PUT request response url: http://swatch-billable-usage-service:8000/api/swatch-billable-usage/internal/rpc/topics/flush, status_code: 200 2025-06-27 02:02:39 INFO Trace log using : 00-00000000000000000000000000000000-0000000000000000-00 2025-06-27 02:02:41 INFO DELETE request response url: http://swatch-tally-service:8000/api/rhsm-subscriptions/v1/internal/rpc/tally/3340851, status_code: 200 2025-06-27 02:02:41 INFO Trace log using : 00-140306e75ab996390f92d908db2d78be-5b6acfee6b6b78da-00 2025-06-27 02:02:41 INFO Reset moto b'{"status": "ok"}' 2025-06-27 02:02:41 INFO Creating event with data: {'billing_provider': 'aws', 'billing_account_id': '956238fa-b2fc-4498-9954-0bb215925649', 'vcpus': 1} 2025-06-27 02:02:41 INFO POST request response url: http://swatch-tally-service:8000/api/rhsm-subscriptions/v1/internal/rpc/tally/events, status_code: 200 2025-06-27 02:02:41 INFO Trace log using : 00-e9e6d4fd756f613ecce23538706fe3dd-1557ba564410cf74-00 2025-06-27 02:02:41 INFO GET request response url: http://swatch-tally-service:8000/api/rhsm-subscriptions/v1/internal/rpc/tally/events/3340851?begin=2025-06-26T14%3A00%3A00Z&end=2025-06-26T15%3A00%3A00Z, status_code: 200 2025-06-27 02:02:41 INFO Trace log using : 00-2dfd3babaf08e631f17d76b06554de6b-9cc8c7ec10f34a15-00 2025-06-27 02:02:41 INFO Found events after saving: [] 2025-06-27 02:02:42 INFO GET request response url: http://swatch-tally-service:8000/api/rhsm-subscriptions/v1/internal/rpc/tally/events/3340851?begin=2025-06-26T14%3A00%3A00Z&end=2025-06-26T15%3A00%3A00Z, status_code: 200 2025-06-27 02:02:42 INFO Trace log using : 00-6351bcb1eaa179d98d4e62e6117ce93a-f65a646818e2a868-00 2025-06-27 02:02:42 INFO Found events after saving: [ { "billing_account_id": "956238fa-b2fc-4498-9954-0bb215925649", "billing_provider": "aws", "conversion": false, "display_name": "automation__cluster_test-cluster-uuid", "event_id": "e23c8313-b520-46dd-9a2e-63ca7fa8695c", "event_source": "rhelemeter", "event_type": "vCPUs", "expiration": "2025-06-26T15:00:00Z", "instance_id": "test-cluster-uuid", "isHypervisor": false, "isUnmappedGuest": false, "isVirtual": false, "measurements": [ { "metric_id": "vCPUs", "value": 1.0 } ], "org_id": "3340851", "product_ids": [ "204" ], "product_tag": [ "rhel-for-x86-els-payg-addon" ], "record_date": "2025-06-27T02:02:41.556485414Z", "service_type": "RHEL System", "sla": "Premium", "timestamp": "2025-06-26T14:00:00Z" } ] 2025-06-27 02:02:42 INFO SKUs for rhel-for-x86-els-payg-addon : ['RH02985HR'] 2025-06-27 02:02:42 INFO PUT request response url: http://swatch-contracts-service:8000/api/swatch-contracts/internal/rpc/offerings/sync/RH02985HR, status_code: 200 2025-06-27 02:02:42 INFO Trace log using : 00-f8adec88c09efa23f0a8e6b0c9589b51-b56ada12db3ea428-01 2025-06-27 02:02:42 INFO Offering RH02985HR synced. 2025-06-27 02:02:42 INFO POST request response url: http://swatch-contracts-service:8000/api/swatch-contracts/internal/subscriptions?reconcileCapacity=true, status_code: 200 2025-06-27 02:02:42 INFO Trace log using : 00-ce2d7d46453ac7047bbaa9bc3e08f23e-3f75dc4e000bd880-01 2025-06-27 02:02:42 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:02:42 INFO GET request response url: http://swatch-billable-usage-service:8000/api/swatch-billable-usage/internal/remittance/accountRemittances?productId=rhel-for-x86-els-payg-addon&orgId=3340851&metricId=vCPUs&billingProvider=aws&billingAccountId=956238fa-b2fc-4498-9954-0bb215925649, status_code: 200 2025-06-27 02:02:42 INFO Trace log using : 00-00000000000000000000000000000000-0000000000000000-00 2025-06-27 02:02:42 INFO POST request response url: http://swatch-tally-service:8000/api/rhsm-subscriptions/v1/internal/tally/hourly?org=3340851&start=2025-06-26T13%3A02%3A41Z&end=2025-06-26T20%3A02%3A41Z, status_code: 204 2025-06-27 02:02:42 INFO Trace log using : 00-7f7af4eaa59c9d9e950a8a162291ae16-6a6cdd8c25b6792c-00 2025-06-27 02:02:42 INFO Not valid JSON output. Returning plain text message. 2025-06-27 02:02:42 INFO Tally synced from 2025-06-26T13:02:41Z to 2025-06-26T20:02:41Z. 2025-06-27 02:02:42 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:02:42 INFO Waiting for hourly tally sync completion... 2025-06-27 02:02:57 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:02:57 INFO Waiting for hourly tally sync completion... 2025-06-27 02:03:12 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:03:12 INFO Waiting for hourly tally sync completion... 2025-06-27 02:03:27 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:03:27 INFO Waiting for hourly tally sync completion... 2025-06-27 02:03:42 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:03:42 INFO Waiting for hourly tally sync completion... 2025-06-27 02:03:57 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:03:57 INFO Waiting for hourly tally sync completion... 2025-06-27 02:04:12 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:04:12 INFO Waiting for hourly tally sync completion... 2025-06-27 02:04:27 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:04:27 INFO Waiting for hourly tally sync completion... 2025-06-27 02:04:42 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:04:42 INFO Waiting for hourly tally sync completion... 2025-06-27 02:04:57 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:04:57 INFO Waiting for hourly tally sync completion... 2025-06-27 02:05:12 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:05:12 INFO Waiting for hourly tally sync completion... 2025-06-27 02:05:27 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:05:27 INFO Waiting for hourly tally sync completion... 2025-06-27 02:05:42 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:05:42 INFO Waiting for hourly tally sync completion... 2025-06-27 02:05:57 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:05:57 INFO Waiting for hourly tally sync completion... 2025-06-27 02:06:13 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:06:13 INFO Waiting for hourly tally sync completion... 2025-06-27 02:06:28 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:06:28 INFO Waiting for hourly tally sync completion... 2025-06-27 02:06:43 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:06:43 INFO Waiting for hourly tally sync completion... 2025-06-27 02:06:58 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:06:58 INFO Waiting for hourly tally sync completion... 2025-06-27 02:07:13 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:07:13 INFO Waiting for hourly tally sync completion... 2025-06-27 02:07:28 INFO REST: GET http://swatch-api-nginx-proxy.ephemeral-bahd7s.svc:8000/api/rhsm-subscriptions/v1/tally/products/rhel-for-x86-els-payg-addon/vCPUs with query params [('billing_account_id', '956238fa-b2fc-4498-9954-0bb215925649'), ('billing_provider', 'aws'), ('granularity', 'Hourly'), ('beginning', '2025-06-26T13:02:41+00:00'), ('ending', '2025-06-26T20:02:41+00:00')] and x-rh-insights-request-id=None 2025-06-27 02:07:28 INFO Waiting for hourly tally sync completion... 2025-06-27 02:07:29 WARNING Execution of job "fetch_and_load_features (trigger: interval[0:00:01], next run at: 2025-06-27 02:07:29 UTC)" skipped: maximum number of running instances reached (1) 2025-06-27 02:07:43 INFO ROLLBACK --------------------------------- Captured Out --------------------------------- 2025-06-27 02:02:39,436 INFO sqlalchemy.engine.Engine select version() 2025-06-27 02:02:39,436 INFO sqlalchemy.engine.Engine [raw sql] {} 2025-06-27 02:02:39,437 INFO sqlalchemy.engine.Engine select current_schema() 2025-06-27 02:02:39,437 INFO sqlalchemy.engine.Engine [raw sql] {} 2025-06-27 02:02:39,438 INFO sqlalchemy.engine.Engine show standard_conforming_strings 2025-06-27 02:02:39,438 INFO sqlalchemy.engine.Engine [raw sql] {} 2025-06-27 02:02:39,439 INFO sqlalchemy.engine.Engine BEGIN (implicit) 2025-06-27 02:07:43,645 INFO sqlalchemy.engine.Engine ROLLBACK