jikan-me / jikan

Unofficial MyAnimeList PHP+REST API which provides functions other than the official API
https://jikan.moe
MIT License
854 stars 94 forks source link

Add scheduled github action for tests #441

Closed pushrbx closed 1 year ago

pushrbx commented 2 years ago

We'd like to get updated if the tests break over time, so we will know if the DOM of MAL pages have changed.

nerg4l commented 2 years ago

This one is a bit problematic if we don't use cache. For example forum and user friend list changes constantly.

irfan-dahir commented 2 years ago

@nerg4l I was thinking the same thing. Not sure what an approach for this would be if we were to update the cache periodically.

pushrbx commented 2 years ago

In the past I used squid proxy, which cached pages for a week. (see my python-mal repo)

We could use the same in this case too, however we need to figure out the best ttl.

nerg4l commented 2 years ago

Then the tests will fail after a week. Not sure how we can make sure to have consistent data with up to date HTML structure. We could maybe run tests against less popular (almost dead) anime, manga, forum, etc.

pushrbx commented 2 years ago

How about some DIY low budget rotating proxy?

The configuration is a bit complicated, afaik you need to set routes in iptables.

irfan-dahir commented 2 years ago

To add to the discussion: An outdated cache for some tests might benefit.

For example, I just added approved to the Anime/Manga model to help detect entries that have been deleted from MAL or are not approved. So we can remove them from the search on the REST API or delete them in a scheduled sweep. Commit: https://github.com/jikan-me/jikan/commit/be4bc5759dc960ca1ec232092fba14ceb4fb46ba

This adds a fixture of entries which are unapproved: https://github.com/jikan-me/jikan-fixtures/commit/197b8b4c5444faa083c4b9a1ea0123eb52b887d9 As of testing: https://myanimelist.net/anime/48104 is pending approval

Since this would later be either

  1. Approved by MAL (XPath will no longer be valid)
  2. Rejected by MAL (deleted entry, MAL will return 404 instead)

It would benefit having their fixtures remain unchanged to test against approval status.

github-actions[bot] commented 1 year ago

This issue will be closed and archived in 18 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue.