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

Improving kargo unit tests for currency handling #3106

Merged
merged 1 commit into from
Sep 24, 2018
Merged

Improving kargo unit tests for currency handling #3106

merged 1 commit into from
Sep 24, 2018

Conversation

samuelhorwitz
Copy link
Contributor

Type of change

  • Bugfix
  • Feature
  • New bidder adapter
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Does this change affect user-facing APIs or examples documented on http://prebid.org?
  • Other

Description of change

Kargo was sort of blindsided by #2923 which went out with 1.19.0 and broke our adapter on that version.

I fixed this when it was pointed out to me here: #2958 (comment)

That fix went out with 1.20.0.

I am now updating the tests to better support this as I was expected an incorrect shape for currency from the config. I also make sure all possible paths are tested (if no currency object, if no ad server currency key should both have sane default of "USD").

This is the kind of thing that boils down to me misunderstanding the shape of a config a year ago, and no issues arising from it until more stringent external checks were added. Unit testing wouldn't really catch it as I believe my practice of mocking the config for the unit tests is correct (although my incorrect mocking due to human error/misunderstanding is obviously wrong).

Anyone have any ideas how stuff like this could be avoided in the future? Is there an automated integration or E2E testing in the pipeline for adapters to contribute to?

@samuelhorwitz samuelhorwitz changed the title improving kargo unit tests for currency handling Improving kargo unit tests for currency handling Sep 19, 2018
@jsnellbaker
Copy link
Collaborator

@samuelhorwitz

I looked over your test changes and they seem good.

In terms of your questions, there's nothing at present in the project that does a full e2e type of testing in an automated fashion. This may be something that's looked at in the future, but I don't know of any definite plans yet.

In the meantime - these types of checks normally performed by the reviewers, who would checkout the PR's branch and test it locally to verify the functionality. Ideally the original issue would have been observed much earlier (when the code was implemented) so it wouldn't have been a surprise, but that's not how it turned out. :(

As you noted, mocking the currency config is the ideal here as your unit tests should focus on how your adapter code is working. The mocks though do need to represent how that feature is actually working - so that the proper responses /objects are used in the tests and the wrong assumptions aren't made.

Once it's set though, it should be reliable. The only times it might be changed is during a major version upgrade, where breaking changes may be incorporated into the project. But these are announced and propagated so as to let everyone know what changes are coming and allow them to adjust.

@jsnellbaker jsnellbaker merged commit d7f7ab6 into prebid:master Sep 24, 2018
ptomasroos pushed a commit to happypancake/Prebid.js that referenced this pull request Sep 25, 2018
StefanWallin pushed a commit to mittmedia/Prebid.js that referenced this pull request Sep 28, 2018
ArmandChoy pushed a commit to RockYou-Ads/Prebid.js that referenced this pull request Sep 28, 2018
* 'master' of https://github.com/prebid/Prebid.js: (367 commits)
  Rubicon adapter: get referrer from bidderRequest.refererInfo.referer; (prebid#3087)
  Minor freewheel-ssp update (prebid#3119)
  fixes prebid#3128 YieldlabBidAdapter is not using bidRequest.params.adSize (prebid#3129)
  Support Video Renderer (prebid#3104)
  Fix for Issue 3130: passing new copy of adUnits object to every adapter (prebid#3131)
  Add video params to Beachfront adapter (prebid#3121)
  Sonobi - Fix ref encoding (prebid#3125)
  update circleci link to just Prebid.js builds (prebid#3132)
  Bugfix: Issue 3111 (prebid#3122)
  increment prebid version
  Prebid 1.25.0 Release
  adding account to s2s bidder-sync request (prebid#3123)
  Revert "Trafficroots Bid Adapter Submission (prebid#2993)" (prebid#3124)
  Trafficroots Bid Adapter Submission (prebid#2993)
  add versioning and deprecation policy doc (prebid#3103)
  improving kargo unit tests for currency handling (prebid#3106)
  AdOcean adapter improvment (prebid#3011)
  Serverbid Bid Adapter: Add pubnx alias (prebid#3064)
  Adds an id parameter (prebid#3107)
  added sizes for rubicon (prebid#3094)
  ...
SublimeJeremy pushed a commit to SublimeSkinz/Prebid.js that referenced this pull request Oct 1, 2018
ghost pushed a commit to devunrulymedia/Prebid.js that referenced this pull request Jan 30, 2019
pedrolopezmrf pushed a commit to Marfeel/Prebid.js that referenced this pull request Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants