Commit b14d3959 authored by Andrew Roetker's avatar Andrew Roetker

(PDB-1984) Update example-reports for benchmarking tool to v6

This commit updates the benchmarking example-reports to v6 from v5 of
the reports wire-format.
parent 777f536a
......@@ -139,14 +139,22 @@
[stamp n]
(time/plus stamp (time/seconds (rand-int n))))
(defn update-report-resources [resources stamp]
(let [timestamp (jitter stamp 300)
update-timestamps-fn (fn [resources-or-events]
(map #(assoc % "timestamp" timestamp)
resources-or-events))]
(->> resources
update-timestamps-fn
(map #(update % "events" update-timestamps-fn)))))
(defn update-report
"configuration_version, start_time and end_time should always change
on subsequent report submittions, this changes those fields to avoid
computing the same hash again (causing constraint errors in the DB)"
[report uuid stamp]
(-> report
(update "resource_events" (partial map #(assoc % "timestamp"
(jitter stamp 300))))
(update "resources" update-report-resources stamp)
(assoc "configuration_version" (kitchensink/uuid)
"transaction_uuid" uuid
"start_time" (time/minus stamp (time/seconds 10))
......@@ -202,7 +210,7 @@
factset (some-> factset
(update-factset rand-percentage stamp))]
(when catalog (>!! command-send-ch [:catalog 6 catalog]))
(when report (>!! command-send-ch [:report 5 report]))
(when report (>!! command-send-ch [:report 6 report]))
(when factset (>!! command-send-ch [:factset 4 factset]))
(assoc state
......
......@@ -225,7 +225,6 @@
is left over."
[payload]
(as-> payload $
(wire-v5->wire-v6 $)
(pls/strip-unknown-keys report-wireformat-schema $)
(update $ :resources sanitize-resources)))
......
......@@ -31,7 +31,7 @@
(deftest test-sanitize-report
(testing "no action on valid reports"
(let [test-data (:basic reports)]
(= (sanitize-report test-data) test-data))))
(= (sanitize-report (wire-v5->wire-v6 test-data)) test-data))))
(defn underscore->dash-report-keys [m]
(->> m
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment