fix: selection algo filtering on max price fixed
What does this pull request do? Explain your changes. (required)
Fixes behavior of gateway when no max price is set. 0 maxPrice will return to being no max price filter enabled.
The addition of maxPricePerCapability included initializing a zero max price by default so the map is fully initialized. This broke the filterByMaxPrice function that checked for an unset maxPrice of nil.
Specific updates (required)
- updates
filterByMaxPricefunction inselection_algorithm.goto check for 0 rather than checking for nil - added test to cover this so will fail in future if behavior of max price filtering changes
- updated TestFilter test to set a maxPrice of 0 if none set
How did you test each of these updates (required)
Added new test and ran all tests in selection_algorithm_test.go
Does this pull request close any open issues?
Checklist:
- [ ] Read the contribution guide
- [X]
makeruns successfully - [ ] All tests in
./test.shpassX selection_algorithm_test.go pass. - [ ] README and other documentation updated
- [ ] Pending changelog updated
I updated for suggested change. Learned something new, did not know Sign() did that!
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 30.56667%. Comparing base (
0cf87dc) to head (181d727).
Additional details and impacted files
@@ Coverage Diff @@
## master #3179 +/- ##
=============================================
Coverage 30.56667% 30.56667%
=============================================
Files 152 152
Lines 45494 45494
=============================================
Hits 13906 13906
Misses 30770 30770
Partials 818 818
| Files with missing lines | Coverage Δ | |
|---|---|---|
| server/selection_algorithm.go | 90.58824% <100.00000%> (ø) |
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 0cf87dc...181d727. Read the comment docs.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| server/selection_algorithm.go | 90.58824% <100.00000%> (ø) |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.