Skip to content
Snippets Groups Projects
Unverified Commit 5ca09b8f authored by Braden Shepherdson's avatar Braden Shepherdson Committed by GitHub
Browse files

Deflake the Serdes v2 e2e test by ensuring generated inputs are unique (#24320)

parent 18f05904
Branches
Tags
No related merge requests found
......@@ -281,6 +281,11 @@
(def ^:private unique-name (mbql.u/unique-name-generator))
(defn- unique-email [email]
(let [at (.indexOf email "@")]
(str (unique-name (subs email 0 at))
(subs email at))))
(def ^:private field-positions (atom {:table-fields {}}))
(defn- adjust
"Some fields have to be semantically correct, or db correct. fields have position, and they do have to be unique.
......@@ -295,6 +300,14 @@
(-> (swap! field-positions update-in [:table-fields (:table_id visit-val)] (fnil inc 0))
(get-in [:table-fields (:table_id visit-val)])))
;; Users' emails need to be unique. This enforces it, and appends junk to before the @ if needed.
(= ent-type :core_user)
(update :email unique-email)
;; Database names need to be unique. This enforces it, and appends junk to names if needed.
(= ent-type :database)
(update :name unique-name)
;; Table names need to be unique within their database. This enforces it, and appends junk to names if needed.
(= ent-type :table)
(update :name unique-name)
......@@ -303,6 +316,10 @@
(= ent-type :field)
(update :name unique-name)
;; Native Query Snippet names need to be unique. This enforces it, and appends junk to names if needed.
(= ent-type :native-query-snippet)
(update :name unique-name)
;; [Field ID, Dimension name] pairs need to be unique. This enforces it, and appends junk to names if needed.
(= ent-type :dimension)
(update :name unique-name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment