Get GCE image price
Add new method to get gce image price
Add tests
Description
Getting GCE image price right now with
libcloud.pricing.get_pricing(driver_type='compute', driver_name='gce_images')
is broken. I added a separate method to do that since gce images price dictionary veers off the pattern of the rest of the pricing data. I added some tests that use directly the pricing data and not the mock pricing data, on purpose, the main reason is to detect any changes in the format of the pricing data by Google.
Status
- done, ready for review
Checklist (tick everything that applies)
- [x] Code linting (required, can be done after the PR checks)
- [x] Documentation
- [x] Tests
- [x] ICLA (required for bigger changes)
Codecov Report
Merging #1699 (de44494) into trunk (027b668) will decrease coverage by
0.00%. The diff coverage is81.81%.
@@ Coverage Diff @@
## trunk #1699 +/- ##
==========================================
- Coverage 83.29% 83.28% -0.01%
==========================================
Files 400 400
Lines 87774 87862 +88
Branches 10690 10708 +18
==========================================
+ Hits 73108 73180 +72
- Misses 11486 11495 +9
- Partials 3180 3187 +7
| Impacted Files | Coverage Δ | |
|---|---|---|
| libcloud/pricing.py | 68.93% <68.62%> (-0.20%) |
:arrow_down: |
| libcloud/test/test_pricing.py | 97.56% <100.00%> (+1.04%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 027b668...de44494. Read the comment docs.
Short therm this change looks good to me, but long term we should figure out how we can integrate it into standard get_size_pricing() method.
@Eis-D-Z Thanks for the contribution. Would it be possible to implement something like this https://github.com/apache/libcloud/pull/1699/files#r889676868?
Hey Tomaz, Of course, sorry for the delay. I am on it.
Hi Tomaz, I'm very sorry, I got some issues and only just now resolved them. I can continue to improve the PR to be inline with the overall philosophy. I do have some questions though:
-
get_size_price has
sizein its name so it might be misleading to return image price, do you want to rename the method or are you cool with this. -
I will need to add two arguments,
image_nameandcores, and naming is my weak point. Are those names alright? -
I am preparing another PR with prices for EC2, because AWS have added to their official endpoint prices. (The same endpoint where we get the sizes) I will open it within the day on a separate PR, I believe you wouldn't want to add it in this PR.
Cheers Alex
@Eis-D-Z
-
In this case, to reduce confusion it would probably be better to introduce a new function, e.g.
get_image_priceor similar. -
If we go with 1), I assume those arguments will then be added to this new function? I guess it may still be somewhat confusing since "cores" implies size to some extent, but I know that some image licensing is based on number of cores, so it probably also fine / make sense to add it there.
Ok I will go with 1. Message ID: @.***>
@Eis-D-Z Changes look good to me, but unit tests appear to be failing. Can you please have a look when you get a chance? Thanks.
@Eis-D-Z How is this PR looking? Would be great if we could get it wrapped up merged. Thanks.
@Kami Excuse me for the delay.