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-5627] Fix Azure default extension issue #5394

Merged
merged 20 commits into from
Dec 2, 2024

Conversation

bacciotti
Copy link
Contributor

Jira Ticket

COST-5627

Description

This change fixes the issue of a hardcoded file extension (csv) when no manifest is present. Now, the program dynamically identifies and selects the latest file with supported extensions, such as .csv or .gz.

Testing

  1. Checkout Branch
  2. Restart Koku
  3. Ingest csv and csv.gz data with and without a mainfest.json file
  4. Run some Azure unit tests, like tox -e py311 -- masu.test.external.downloader.azure

Release Notes

  • Fix Azure default extension issue
* [COST-5627](https://issues.redhat.com/browse/COST-5627) Fix Azure default extension issue

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.1%. Comparing base (3d8ded0) to head (a689750).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5394   +/-   ##
=====================================
  Coverage   94.1%   94.1%           
=====================================
  Files        371     371           
  Lines      31540   31535    -5     
  Branches    3379    3378    -1     
=====================================
- Hits       29689   29686    -3     
+ Misses      1200    1199    -1     
+ Partials     651     650    -1     

@bacciotti bacciotti added the azure-smoke-tests pr_check will build the image and run azure + ocp on azure smoke tests label Nov 22, 2024
@bacciotti
Copy link
Contributor Author

/retest

@bacciotti
Copy link
Contributor Author

/retest

Copy link
Contributor

@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.

How did you test with a manifest? Because I'm fairly sure even if we have one it will just run as if we don't. The code here probably works but its also confusing in places (the azure downloader in general at this point) because of how we treat manifests. We may want to clean up all the extension logic and correctly download all manifest types to reduce the complexity of code overall. Happy to chat through all this if its not clear.

@bacciotti
Copy link
Contributor Author

/retest

Copy link
Contributor

@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.

Ultimately what you have does seem to work and is a step in the right direction. I couple of little nit-picks that would be worth tweaking but otherwise we can probably go for this. 👍

if extension:
if not blob.name.endswith(extension):
continue
elif not any(blob.name.endswith(ext) for ext in valid_extensions):
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just drop this logic and the valid extensions list above? Essentially if we are not trying to download a manifest this elif statement is going to mangle file types together anyway so its kinda redundant no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropping this logic broke the tests, which indicates that this filtering is needed. Dropping this logic, we can lose control over the extensions used, I think. Maybe we can keep it to maintain the consistency and align with the existing tests...

koku/masu/external/downloader/azure/azure_service.py Outdated Show resolved Hide resolved
@bacciotti
Copy link
Contributor Author

/retest

1 similar comment
@bacciotti
Copy link
Contributor Author

/retest

Copy link
Contributor

@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.

Great job Lucas!

@bacciotti bacciotti enabled auto-merge (squash) November 29, 2024 12:44
@bacciotti
Copy link
Contributor Author

/retest

2 similar comments
@bacciotti
Copy link
Contributor Author

/retest

@bacciotti
Copy link
Contributor Author

/retest

@lcouzens lcouzens added smoke-tests pr_check will build the image and run minimal required smokes and removed azure-smoke-tests pr_check will build the image and run azure + ocp on azure smoke tests labels Dec 1, 2024
@lcouzens
Copy link
Contributor

lcouzens commented Dec 1, 2024

/retest

2 similar comments
@bacciotti
Copy link
Contributor Author

/retest

@bacciotti
Copy link
Contributor Author

/retest

@bacciotti bacciotti merged commit 3870f77 into main Dec 2, 2024
14 checks passed
@bacciotti bacciotti deleted the cost-5627-azure-does-not-change-default-extension branch December 2, 2024 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
smoke-tests pr_check will build the image and run minimal required smokes smokes-required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants