Repository: fedora-infra/bodhi

Issue:
UpdateReadyForTestingV1 needs to be sent only for rpm build updates
For other content (modules, flatpaks, containers) a new message will be needed.

We should check the `update.content_type` in `_ready_for_testing` method and only send the message if the contentType is rpm.

https://github.com/fedora-infra/bodhi/blob/develop/bodhi/server/models.py#L3900


Discussion:
> For other content (modules, flatpaks, containers) a new message will be needed.

Any requirements?

Resolving patch:
diff --git a/bodhi/server/models.py b/bodhi/server/models.py
--- a/bodhi/server/models.py
+++ b/bodhi/server/models.py
@@ -3952,6 +3952,8 @@ def _ready_for_testing(target, value, old, initiator):
             # This is the object initialization phase. This instance is not ready, don't create
             # the message now. This method will be called again at the end of __init__
             return
+        if target.content_type != ContentType.rpm:
+            return
 
         message = update_schemas.UpdateReadyForTestingV1.from_dict(
             message=target._build_group_test_message()
diff --git a/bodhi/server/services/updates.py b/bodhi/server/services/updates.py
--- a/bodhi/server/services/updates.py
+++ b/bodhi/server/services/updates.py
@@ -728,9 +728,10 @@ def trigger_tests(request):
         log.error("Can't trigger tests for update: Update is not in testing status")
         request.errors.add('body', 'request', 'Update is not in testing status')
     else:
-        message = update_schemas.UpdateReadyForTestingV1.from_dict(
-            message=update._build_group_test_message()
-        )
-        notifications.publish(message)
+        if update.content_type == ContentType.rpm:
+            message = update_schemas.UpdateReadyForTestingV1.from_dict(
+                message=update._build_group_test_message()
+            )
+            notifications.publish(message)
 
     return dict(update=update)


Test patch:
diff --git a/bodhi/tests/server/services/test_releases.py b/bodhi/tests/server/services/test_releases.py
--- a/bodhi/tests/server/services/test_releases.py
+++ b/bodhi/tests/server/services/test_releases.py
@@ -20,7 +20,7 @@
 from datetime import datetime
 
 import webtest
-from fedora_messaging import api, testing as fml_testing
+from fedora_messaging import testing as fml_testing
 
 from bodhi import server
 from bodhi.server.config import config
@@ -550,7 +550,7 @@ def _add_updates(updateslist, user, release, packagesuffix):
                           [UpdateType.enhancement, 23],
                           [UpdateType.newpackage, 22]]]]
 
-        with fml_testing.mock_sends(*[api.Message] * 54):
+        with fml_testing.mock_sends():
             _add_updates(addedupdates, user2, currentrelease, "fc17")
 
         pendingrelease = self.db.query(Release).filter_by(name='F18').one()
@@ -569,7 +569,7 @@ def _add_updates(updateslist, user, release, packagesuffix):
                            [UpdateType.bugfix, 4],
                            [UpdateType.enhancement, 4],
                            [UpdateType.newpackage, 4]]]]
-        with fml_testing.mock_sends(*[api.Message] * 12):
+        with fml_testing.mock_sends():
             _add_updates(addedupdates2, user2, pendingrelease, "fc18")
         self.db.flush()
         # Clear the caches