Skip to content

MeteringMarketplace: Support CustomerAWSAccountId in BatchMeterUsage - #10133

Open
Sgitario wants to merge 1 commit into
getmoto:masterfrom
Sgitario:customer_aws_account_id
Open

MeteringMarketplace: Support CustomerAWSAccountId in BatchMeterUsage#10133
Sgitario wants to merge 1 commit into
getmoto:masterfrom
Sgitario:customer_aws_account_id

Conversation

@Sgitario

Copy link
Copy Markdown

Description

BatchMeterUsage UsageRecords may identify the buyer with either
CustomerIdentifier or CustomerAWSAccountId (AWS Concurrent Agreements).
Moto previously required CustomerIdentifier and raised KeyError when only
CustomerAWSAccountId was present.

This change accepts either field (or both), echoes the provided fields on the
returned UsageRecord, and uses a shared customer key for subscription /
duplicate checks.

Testing

pytest tests/test_meteringmarketplace/test_meteringmarketplace.py -q

@Sgitario

Copy link
Copy Markdown
Author

Hi @bblommers , this is my first contribution to this project and I was looking to get a review on supporting CustomerAWSAccountId :)

Sgitario added a commit to RedHatInsights/rhsm-subscriptions that referenced this pull request Jul 28, 2026
#6415)

Jira issue: SWATCH-5116

## Description
The IQE tests use Moto to validate the happy path scenarios when
submitting AWS usages.
However, moto does not support the CustomerAWSAccountId field (I
contributed to moto to support this
getmoto/moto#10133).

In the mean time, this is a workaround / hack to support
CustomerAWSAccountId and CustomerIdentifier both fields.
This is necessary to validate the CustomerAWSAccountId (AWS concurrent
agreements epic) in the IQE tests.
I also reported https://redhat.atlassian.net/browse/SWATCH-5317 to stop
using Moto (which does not guarantee the compatibility with AWS SDK) and
start using Wiremock as done in the component tests.

## Testing
IQE MR:
https://gitlab.cee.redhat.com/insights-qe/iqe-rhsm-subscriptions-plugin/-/merge_requests/1560

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved AWS Marketplace metering compatibility by correctly handling
customer account identifiers during batch usage reporting.
- Enhanced local service startup reliability and validation for metering
workflows.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant