theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
147 stars 164 forks source link

don't record pending tasks in fixtures #1182

Open evgeni opened 3 years ago

evgeni commented 3 years ago

William has manually dropped a big chunk of "poll pending task" requests to speed up things and reduce the size of the fixtures. I wonder if that's something we should do by default? I.e. GET /api/foreman_tasks/:id and state: pending in reply → don't record.

Matthias suggests to at least record the very first one, which sounds like a good idea too.

Originally posted by @evgeni in https://github.com/theforeman/foreman-ansible-modules/issues/1135#issuecomment-803969230

wbclark commented 3 years ago

I actually kept the first two, since the very first one returns state: planned, result: pending and the second returns state: running, result: pending and then I saw there were many which were basically identical from that point

wbclark commented 3 years ago

Discussing with @mdellweg in triage today, we had some thoughts about implementation:

I. We should look for the capability to do this natively with VCR (i.e. https://vcrpy.readthedocs.io/en/latest/advanced.html#register-your-own-cassette-persister , or https://vcrpy.readthedocs.io/en/latest/advanced.html#custom-request-filtering if enough state is stored to recognize the duplicate responses)

II. Failing that, updating the record target in the Makefile to perform this trimming so there is no additional overhead for the user