Fix race in test_crd_gate_unknown

Change-Id: Ifae623eccd4ea992f4f4bfec8a141da8d5052a67
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index 0ac42c1..19bcb61 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -3868,9 +3868,12 @@
         self.assertEqual(B.reported, 0)
         self.assertEqual(len(self.history), 0)
 
-        # Simulate change B being gated outside this layout
-        self.fake_gerrit.addEvent(B.addApproval('approved', 1))
+        # Simulate change B being gated outside this layout Set the
+        # change merged before submitting the event so that when the
+        # event triggers a gerrit query to update the change, we get
+        # the information that it was merged.
         B.setMerged()
+        self.fake_gerrit.addEvent(B.addApproval('approved', 1))
         self.waitUntilSettled()
         self.assertEqual(len(self.history), 0)