From 7d47165cc0830bbfcbd0eaf5975ef9101deaa6fd Mon Sep 17 00:00:00 2001 From: Valtteri Harmainen Date: Sun, 24 Nov 2024 11:01:49 +0200 Subject: [PATCH] Patch flaky tests --- webapp/test/clj/lipas/test_utils.clj | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webapp/test/clj/lipas/test_utils.clj b/webapp/test/clj/lipas/test_utils.clj index 6b2f59195..c6d2911dd 100644 --- a/webapp/test/clj/lipas/test_utils.clj +++ b/webapp/test/clj/lipas/test_utils.clj @@ -12,6 +12,7 @@ [lipas.backend.search :as search] [lipas.backend.system :as sy] [lipas.schema.core] + [lipas.utils :as utils] [migratus.core :as migratus] [ring.mock.request :as mock]) (:import [java.io ByteArrayOutputStream] @@ -20,7 +21,10 @@ (defn gen-sports-site [] (try - (gen/generate (s/gen :lipas/sports-site)) + ;; FIXME :ptv generators produce difficult values + (-> (s/gen :lipas/sports-site) + gen/generate + (dissoc :ptv)) (catch Throwable _t (gen-sports-site)))) (def <-json #(j/parse-string (slurp %) true)) @@ -169,3 +173,7 @@ (-> (gen/generate (s/gen :lipas.loi/document)) (assoc :status "active") (assoc :id (str (java.util.UUID/randomUUID))))) + +(comment + (every? #(s/valid? :lipas/sports-site %) (repeatedly 100 gen-sports-site)) + )