Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWATCH-2611: Update existing billable_usage_remittance status to unknown #3819

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Sgitario
Copy link
Contributor

@Sgitario Sgitario commented Oct 2, 2024

Jira issue: SWATCH-2611

Description

All existing billable_usage_remittance older than the release where we started populating the statuses ( Prior to October 1) where status='pending' or status is null records updated to have status='unknown'

Testing

  1. start database
  2. checkout the main branch (to not use the migration script from this PR)
  3. start api service to migrate the schema: SPRING_PROFILES_ACTIVE=api DEV_MODE=true ./gradlew :bootRun
  4. stop the api service
  5. create the following usages:
-- old usage without status: needs to be updated with unknown
INSERT INTO billable_usage_remittance(uuid, org_id, product_id, metric_id, accumulation_period, sla, usage, billing_provider, billing_account_id, remittance_pending_date, remitted_pending_value)
VALUES ('c2d29867-3d0b-d497-9191-18a9d8ee7830', 'org123', 'rosa', 'CORES', '2024-02', 'Premium', 'Production', 'azure', '123456', '2023-02-11T04:00:09.620406Z', '4.0');

-- recent usage without status: no updates here because remittance_pending_date is more recent than 1 oct
INSERT INTO billable_usage_remittance(uuid, org_id, product_id, metric_id, accumulation_period, sla, usage, billing_provider, billing_account_id, remittance_pending_date, remitted_pending_value)
VALUES ('c2d29867-3d0b-d497-9191-18a9d8ee7831', 'org124', 'rosa', 'CORES', '2024-02', 'Premium', 'Production', 'azure', '123456', '2024-10-01T04:00:09.620406Z', '4.0');

-- old usage with status 'pending': needs to be updated with unknown
INSERT INTO billable_usage_remittance(uuid, org_id, product_id, metric_id, accumulation_period, sla, usage, billing_provider, billing_account_id, remittance_pending_date, remitted_pending_value, status)
VALUES ('c2d29867-3d0b-d497-9191-18a9d8ee7832', 'org125', 'rosa', 'CORES', '2024-02', 'Premium', 'Production', 'azure', '123456', '2023-02-11T04:00:09.620406Z', '4.0', 'pending');

-- old usage with status 'failed': no updates because status was not pending
INSERT INTO billable_usage_remittance(uuid, org_id, product_id, metric_id, accumulation_period, sla, usage, billing_provider, billing_account_id, remittance_pending_date, remitted_pending_value, status)
VALUES ('c2d29867-3d0b-d497-9191-18a9d8ee7833', 'org126', 'rosa', 'CORES', '2024-02', 'Premium', 'Production', 'azure', '123456', '2023-02-11T04:00:09.620406Z', '4.0', 'failed');
  1. checkout the jcarvaja/SWATCH-2611 branch
  2. start api service to migrate the schema: SPRING_PROFILES_ACTIVE=api DEV_MODE=true ./gradlew :bootRun
  3. check the billable_usage_remittance table where
  • The entry with org_id org123 and org125 should have been updated to status 'unknown' because the usage was before 1 Oct

The rest of entries are expected not to be updated.

All existing billable_usage_remittance older than the release where we started populating the statuses ( Prior to October 1) where status='pending' or status is null records updated to have status='unknown'
@Sgitario Sgitario added QE Pull request should be approved by QE before merge Dev Pull requests that need developer review labels Oct 2, 2024
@ntkathole
Copy link
Member

/retest

@mstead mstead self-assigned this Oct 3, 2024
@mstead mstead self-requested a review October 3, 2024 13:08
Copy link
Contributor

@mstead mstead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, functions as expected.

@mstead mstead added Dev/approved Pull requests that have been approved by all assigned developers and removed Dev Pull requests that need developer review labels Oct 3, 2024
@liwalker-rh liwalker-rh self-requested a review October 4, 2024 16:28
@liwalker-rh liwalker-rh self-assigned this Oct 4, 2024
@liwalker-rh
Copy link

/retest

Copy link

@liwalker-rh liwalker-rh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing locally and in PR checks looks good. Failure in most recent PR check unrelated.

@liwalker-rh liwalker-rh added QE/approved Pull requests that have been approved by all assigned QEs and removed QE Pull request should be approved by QE before merge labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev/approved Pull requests that have been approved by all assigned developers QE/approved Pull requests that have been approved by all assigned QEs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants