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

[COST-5887] - Return source status #5518

Merged
merged 3 commits into from
Feb 26, 2025
Merged

[COST-5887] - Return source status #5518

merged 3 commits into from
Feb 26, 2025

Conversation

lcouzens
Copy link
Contributor

@lcouzens lcouzens commented Feb 25, 2025

Jira Ticket

COST-5887

Description

This change will correctly raise an exception for Forbidden errors when we fail to list GCP bigquery tables. This one is a rare case that happens when the correct roles are set but the Organisation has additional strict VPC Service Controls.

Testing this was kinda a pain!

  1. I created a service account in GCP that didnt have the correct access to list bigquery tables.
  2. loaded Django shell
  3. Created bigquery client using the created creds
  4. Tried to list tables with a dataset in the dev account
  5. you should get a forbidden error.
  • import google.auth
  • from google.cloud import bigquery
  • gcp_credentials, _ = google.auth.default() (You need to put the auth file in the correct location, probably get an error saying where)
  • client = bigquery.Client()
  • for table in client.list_tables('nise_dataset'):
    ...: print(table.full_table_id)

This should raise a forbidden error similar to the alert.

Release Notes

  • proposed release note
* [COST-5887](https://issues.redhat.com/browse/COST-5887) Send source status checks from exceptions

@lcouzens lcouzens added the smoke-tests pr_check will build the image and run minimal required smokes label Feb 25, 2025
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.1%. Comparing base (96dccda) to head (6e115d3).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5518   +/-   ##
=====================================
  Coverage   94.1%   94.1%           
=====================================
  Files        371     371           
  Lines      31569   31574    +5     
  Branches    3385    3385           
=====================================
+ Hits       29712   29717    +5     
+ Misses      1205    1203    -2     
- Partials     652     654    +2     

@lcouzens lcouzens marked this pull request as ready for review February 25, 2025 13:34
@lcouzens lcouzens requested review from a team as code owners February 25, 2025 13:34
Copy link
Member

@maskarb maskarb left a comment

Choose a reason for hiding this comment

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

Is COST-5886 the correct issue?

Copy link
Contributor Author

@lcouzens lcouzens left a comment

Choose a reason for hiding this comment

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

Thanks Michael! And Yes I did link the wrong issue Sorry! 5887 not 5886

@lcouzens lcouzens changed the title [COST-5886] - Return source status [COST-5887] - Return source status Feb 25, 2025
@lcouzens lcouzens added hot-fix-smoke-tests pr_check label to run minimal smoke tests for fast moving bug-fix and removed smoke-tests pr_check will build the image and run minimal required smokes labels Feb 26, 2025
@lcouzens
Copy link
Contributor Author

Full smokes passed.

@lcouzens
Copy link
Contributor Author

/retest

@lcouzens lcouzens enabled auto-merge (squash) February 26, 2025 17:22
@lcouzens lcouzens merged commit 7b2b6dd into main Feb 26, 2025
14 checks passed
@lcouzens lcouzens deleted the COST-5887 branch February 26, 2025 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hot-fix-smoke-tests pr_check label to run minimal smoke tests for fast moving bug-fix smokes-required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants