 
             (let [failed-cmdref (take-with-timeout!! command-chan default-timeout-ms)]
               (is (= 1 (count (:attempts failed-cmdref))))
-              (is (re-matches
-                   #"(?sm).*ERROR: could not serialize access due to concurrent update.*"
-                   (-> failed-cmdref
-                       :attempts
-                       first
-                       :exception
-                       .getNextException
-                       .getMessage))))
+              (is (-> failed-cmdref :attempts first :exception
+                      pg-serialization-failure-ex?)))
 
             (is (true? @first-message?))
             (is (true? @second-message?))))))))

      first
      second))

(deftest concurrent-fact-updates
  (testing "Should allow only one replace facts update for a given cert at a time"
    (with-message-handler {:keys [handle-message dlo delay-pool q command-chan]}

            (is (empty? (fs/list-dir (:path dlo))))
            (let [failed-cmdref (take-with-timeout!! command-chan default-timeout-ms)]
              (is (= 1 (count (:attempts failed-cmdref))))
              (is (-> failed-cmdref :attempts first :exception
                      pg-serialization-failure-ex?)))

            (is (true? @first-message?))
            (is (true? @second-message?))))))))
