Verify updateUrl is PATCH not PUT

Here we verify that `updateUrl` calls follow PATCH semantics rather than PUT, in particular the "partial update" part, to make sure that returning updated `ads`, but nothing else, doesn't wipe out the IG. This includes tests for appropriate preservation with "success cases", i.e. one field should be successfully updated, but also "failure cases", where the update should fail for some technical reason and we'd like to verify that the previous values are not touched. (I suppose it's an interesting case that you might want an IG to be "suspended" if it's not updated for more than X period of time...but I'll leave that for another discussion.

Conclusion

Updates seem to do partial updates according to available fields.

Test Method

We test this by:

  1. Clearing all IGs for the www.pstone.com origin.
  2. Joining a single IG that:
    • Has two "creatives" registered, both of which point at our creative endpoint that will render an HTML document with oooohhh with an accompanying message from the query param. The two options for this test are message "one" or message "two".
    • On initial join, it has a bidding function that is hardcoded to bid on the creative with message = one.
  3. Forcing an update of that IG which is intended to update the bidding function to be the one that is hardcoded to bid on the message = two variant. The idea is that if the update were PUT semantics, the `ads` would be wiped out, since `ads` is not present in the returned values.
  4. We then run an auction that includes only that IG (inviting only www.pstone.com which has only the one after previous steps).
  5. We verify the oooohh image shows up with the appropriate message (which it only will if the one IG bids on it, which it only can if the update didn't wipe the `ads` out).
    • Note that in the "success cases", the message should be "two", and in failure cases it should be "one".

We run this test on variations, once each with the updateUrl returning:

,

Live Test Results

Expected images are below, live demo should pop up bit by bit over a few seconds here.

Results

You can see the results of the code running below. Here you can see the Node console logs from a successful test, indicating that the updateUrls were called (notice 7 calls, one for each option).

And here you can see the correctly rendered oooohh images; had the IGs been wiped out entirely or just the ads component, nothing would show up; additionally the final one showing "message two" verifies that the bidding function was changed resulting in the message two version showing up.