Skip to content

Commit

Permalink
Explicitly use CET timezone for rio queue test
Browse files Browse the repository at this point in the history
  • Loading branch information
mdemare committed Jul 11, 2024
1 parent 6dfe753 commit 9b09af5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/nl/surf/eduhub_rio_mapper/cli_commands.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
[nl.surf.eduhub-rio-mapper.specs.ooapi :as ooapi]
[nl.surf.eduhub-rio-mapper.specs.rio :as rio]
[nl.surf.eduhub-rio-mapper.worker :as worker])
(:import [java.time LocalTime]
[java.util UUID]))
(:import [java.time LocalDateTime]
[java.util TimeZone UUID]))

(defn- parse-getter-args [[type id & [pagina]]]
{:pre [type id (string? type)]}
Expand Down Expand Up @@ -76,15 +76,17 @@
"test-rio"
(let [[client-info args] (parse-client-info-args args clients)
cron (= "cron" (first args))
working (< 9 (.getHour (LocalTime/now)) 17) ; only run between 9:00 and 17:00 local time
tz (.toZoneId (TimeZone/getTimeZone "Europe/Amsterdam"))
offline (not (< 9 (.getHour (LocalDateTime/now tz)) 17)) ; only run between 9:00 and 17:00 local time
uuid (UUID/randomUUID)
eduspec (-> "../test/fixtures/ooapi/education-specification-template.json"
io/resource
slurp
(json/read-str :key-fn keyword)
(assoc :educationSpecificationId uuid))]

(when (or working (not cron))
(if (and cron offline)
(println "Skipping test - not within working hours")
(try
(insert! {:institution-oin (:institution-oin client-info)
:institution-schac-home (:institution-schac-home client-info)
Expand Down

0 comments on commit 9b09af5

Please sign in to comment.