cofacts / rumors-api

GraphQL API server for clients like rumors-site and rumors-line-bot
https://api.cofacts.tw
MIT License
109 stars 26 forks source link

Fix cleanupUrls script #215

Closed MrOrz closed 4 years ago

MrOrz commented 4 years ago

Fixes #210.

As described in #210, the URL cleaning cronjob always fails on production.

Root cause

When we bump elasticsearch client in #153, there was a breaking change that wraps return value of elasticsearch client with an extra {body: }.

At that time we updated all elasticsearch client return values that unit test covered; unfortunately, there is one call-site of elasticsearch client not updated. The call site will not be executed until there are more than 100 urls to scan and delete.

Proposed fix

  1. Add 100 more fixture for cleanupUrls so that it fails unit test
  2. Fix cleanupUrls to make test pass
coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.4%) to 88.582% when pulling f7f59ca8aa602bd990831912844ee06ace755da6 on fix-cleanup-url into a437fae1a9b9ae9339e1fed8e847bc6faf054642 on master.