fedora-infra / bodhi

Bodhi is a web-system that facilitates the process of publishing updates for a Fedora-based software distribution.
https://bodhi.fedoraproject.org
GNU General Public License v2.0
152 stars 194 forks source link

Make non-mocked message publishing fail when running tests in bcd environment #5633

Closed AdamWill closed 5 months ago

AdamWill commented 6 months ago

Working on https://github.com/fedora-infra/bodhi/pull/5630 made me realize that, when running tests in the bcd environment, non-mocked attempts to publish messages 'work', silently and speedily. This is a problem, because they don't do that in the CI environment. They take a very long time and eventually time out; this doesn't usually cause the test to fail, but there is a 30 minute time limit so if you have more than a couple of cases of this, the tests will time out (and obviously we don't want even one, really).

Ideally, we should find a clean way to make non-mocked message publish attempts fail when testing - without breaking message publishing in the bodhi development environment itself. This may not be possible, but hey, we can try.

I don't think we can do this by fiddling with Bodhi's notifications.py because the tests frequently use fedora-messaging's own mock_sends convenience thingy, which requires us to publish 'as normal' all the way out to fedora-messaging. If you e.g. mock out _publish_with_retry, a lot of the tests fail because of this.

I found a dirty way to make 'real' publishing fail - edit fedora_messaging/api.py in the bcd env and make twisted_publish immediately raise an exception when called. That's the hack I used to find all the cases in https://github.com/fedora-infra/bodhi/pull/5630 and fix them. But that's obviously not something we can bake in.

AdamWill commented 5 months ago

Fixed by #5634 which was just merged.