-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
1298 fix fbf0840 #2067
1298 fix fbf0840 #2067
Conversation
…n addBidResponse * bidmanager: move addBidResponse helper functions out of closures
In order to ensure the calling order is correct, call doCallbacks from within addBidToAuction. XXX: This breaks the test that's removed in this patch. The reason it breaks is that the TIMEOUT event is not emitted if all bids have been returned before the timeout handler is called. Previously the bid manager was rejecting the bid if the bid triggered the timeout handler, which doesn't really make much sense. The test SHOULD work if there are two bidders, as the first response should trigger the timeout. I had a hard time adding a second bidder to the test code, so I was hoping to get some help.
@kitwestneat Thanks for adding this back. I missed that earlier. Regarding tests we are working on it. With this #2014 we are updating the stack and increasing the speed to run the tests on local and browserstack. |
* 'master' of https://github.com/prebid/Prebid.js: (51 commits) Update maintainer email (prebid#2132) Replace event string with constant (prebid#2128) Add adapter for IAS (prebid#2056) Fix sovrn dealid (prebid#2119) Added support for NURL and ADM as backup (prebid#2112) fix bug where hooked functions w/ no hooks weren't ran immediately (prebid#2115) Increment pre version Prebid 1.3.1 Release Omit app and device if not present rather than send false (prebid#2116) Increment pre version Prebid.js 1.3.0 Release Unit test fixes (prebid#2111) must explicitly list pre1api for it to be included in build (prebid#2097) adkernel adapter additional bid parameters (prebid#2105) removing userSync (prebid#2032) 33across Bid Adapter: Bugfix + Refactor (prebid#2024) Port calling order fix to 1.x (prebid#2067) Update adform adapter request (prebid#2107) Serverbid Bid Adapter: getUserSyncs and new adsizes (prebid#2106) Add hfa and pv parameter to request payload (prebid#2109) ...
* refactor auctionmanager_spec.js and getKeyValueTargetingPairs consolidate duplicated code into helper functions. * re-add timeout test removed in PR #2067 to auctionmanager_spec.js
* * bidmanager: pass closure variables explicitly to helper functions in addBidResponse * bidmanager: move addBidResponse helper functions out of closures * WIP: call doCallbacks from addBidToAuction In order to ensure the calling order is correct, call doCallbacks from within addBidToAuction. XXX: This breaks the test that's removed in this patch. The reason it breaks is that the TIMEOUT event is not emitted if all bids have been returned before the timeout handler is called. Previously the bid manager was rejecting the bid if the bid triggered the timeout handler, which doesn't really make much sense. The test SHOULD work if there are two bidders, as the first response should trigger the timeout. I had a hard time adding a second bidder to the test code, so I was hoping to get some help.
* refactor auctionmanager_spec.js and getKeyValueTargetingPairs consolidate duplicated code into helper functions. * re-add timeout test removed in PR prebid#2067 to auctionmanager_spec.js
This is a work in progress, I was hoping to get some feedback on the tests.
Type of change
Description of change
This is a port of fbf0840 to 1.0.
The calling order for addBidToAuction and doCallbacksIfNeeded is not consistent. This patch moves most of the calls to doCallbacks into addBidToAuction to make sure it is used consistently.
There is a problem with one of the tests though. A side effect of this change is that the bid that triggers the timeout is added to the bids received list. This seems appropriate to me since if you've waited for and received the bid, it doesn't make sense to throw it away because of timing. However, if that bid is the last bid that prebid was waiting for, the timeout event is not triggered. The test case that I removed in this patch expects that any bid received after the timeout window will trigger the timeout event.
It seems like a fix could be to just add a second bidder so that the triggering bid is not the last bid expected. I tried modifying the test to do that, but ran into a lot of issues getting the test framework to bend to my will. I can bang on it some more, but I thought I'd see if anyone who knows the test system better could help.
As more of a general question, have you all thought about working on the test framework to make it easier to use? There is a lot of duplicated code and partially mocked objects, which makes it confusing to work with. It'd be nice if it were easier to get a standard mocked request / response, and the test could modify it as needed.
The current situation is frustrating and there are times that I don't even submit bugfix patches because the tests are so brittle and difficult to change, like I spend 10x time on wrangling tests vs the actual bugfix. Anyway just my 2c, /rant. Would you all be open to patches to refactor the tests?