From ad3c6400979ff075f70b12e78a6225bc0186e350 Mon Sep 17 00:00:00 2001 From: Michiel de Mare Date: Wed, 24 Jul 2024 14:48:00 +0200 Subject: [PATCH] Explicitly use CET timezone for rio queue test (#320) --- src/nl/surf/eduhub_rio_mapper/cli_commands.clj | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/nl/surf/eduhub_rio_mapper/cli_commands.clj b/src/nl/surf/eduhub_rio_mapper/cli_commands.clj index 02ca583e..1c07fdbb 100644 --- a/src/nl/surf/eduhub_rio_mapper/cli_commands.clj +++ b/src/nl/surf/eduhub_rio_mapper/cli_commands.clj @@ -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)]} @@ -76,7 +76,8 @@ "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 @@ -84,7 +85,8 @@ (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)