Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Bid floor #1085
Bid floor #1085
Changes from 10 commits
3d4e5de
6157af3
e25ac1c
77def7d
03a569b
564b838
0df17f8
cf9def1
c0b3c56
1ca51f1
2085aac
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to add some more test cases for the
buildEndpointURL
method like passing an invalidhost
which will lead tourl.Parse(host)
throwing an error, passing emptytappxkey
, etcTip: You can look at table driven test cases to make it easier to add new test cases and reduce redundant code with multiple test cases. Ref: https://github.com/golang/go/wiki/TableDrivenTests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added test case for url.Parse(host) throwing error.
empty parameter tests should be already covered through JSONBidder tests
there are still some errors that aren't covered like resolving macros or JSON parsing errors, if those are necessary please send us a full list and we will try to write them all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Yeah, that should cover most cases.
The only reason behind that suggestion was that
JSONBidderTests
are more testing theMakeRequest
andMakeBids
function and even thoughbuildEndpointURL
is used as part of theMakeRequest
function, breaking up the unit tests by each function helps to get better coverage. For example, if we have good unit tests written forbuildEndpointURL
and all the other functions thatMakeRequest
andMakeBids
call then we don't have to worry about the different places those functions can fail when writing unit tests forMakeRequest
andMakeBids
themselves. It just makes the tests more readable and manageable.I understand that doing that in this PR can make it a little bloated but just something to consider for next time :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say assert the url to the actual expected string rather than doing a regexp match
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex match was purposely added in order to validate the ts parameter. You can read more about this in one of the first requested changes in this pull request by @guscarreon .
The full URL cannot be asserted since ts value is dynamic. I will add the rest of the URL to the regexp match to make it more robust but I think this cannot be skipped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! I missed the
ts
part before. Makes sense. Thanks for the clarification :)