                        :payload facts}
 
             hand-off-queue (java.util.concurrent.SynchronousQueue.)
-            storage-replace-facts! scf-store/update-facts!]
+            storage-replace-facts! scf-store/update-facts!
+            failures (atom ())
+            orig-annotate-attempt mql/annotate-with-attempt]
 
         (jdbc/with-db-transaction []
           (scf-store/add-certname! certname)

            [puppetlabs.puppetdb.testutils
             :refer [args-supplied call-counter dotestseq times-called]]
            [puppetlabs.puppetdb.jdbc :refer [query-to-vec] :as jdbc]
            [puppetlabs.puppetdb.examples :refer :all]
            [puppetlabs.puppetdb.testutils.services :as svc-utils]
            [puppetlabs.puppetdb.command.constants :refer [command-names]]


            (test-msg-handler new-facts-cmd publish discard-dir
              (reset! second-message? true)
              (is (= 1 (count @failures)))
              (is (re-matches
                   #"(?sm).*ERROR: could not serialize access due to concurrent update.*"
                   (full-sql-exception-msg (first @failures)))))
            @fut
            (is (true? @first-message?))
            (is (true? @second-message?))))))))
