From e31cfd8a94bc3f6dd887af095522e36709156f13 Mon Sep 17 00:00:00 2001 From: Michiel de Mare Date: Wed, 18 Sep 2024 14:48:26 +0200 Subject: [PATCH] Log port when starting api; don't allow default worker port --- src/nl/surf/eduhub_rio_mapper/endpoints/api.clj | 2 ++ src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj | 4 +++- test/nl/surf/eduhub_rio_mapper/e2e_test.clj | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/nl/surf/eduhub_rio_mapper/endpoints/api.clj b/src/nl/surf/eduhub_rio_mapper/endpoints/api.clj index 51b7b3cc..afdefa69 100644 --- a/src/nl/surf/eduhub_rio_mapper/endpoints/api.clj +++ b/src/nl/surf/eduhub_rio_mapper/endpoints/api.clj @@ -19,6 +19,7 @@ (ns nl.surf.eduhub-rio-mapper.endpoints.api (:require [clojure.spec.alpha :as s] [clojure.string :as str] + [clojure.tools.logging :as log] [compojure.core :refer [GET POST]] [compojure.route :as route] [nl.jomco.http-status-codes :as http-status] @@ -250,5 +251,6 @@ (defn serve-api [{{:keys [^Integer port host]} :api-config :as config}] + (log/info (str "Starting api on port " port)) (.addShutdownHook (Runtime/getRuntime) (new Thread ^Runnable shutdown-handler)) (app-server/run-jetty (make-app config) host port)) diff --git a/src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj b/src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj index 1bdee3be..d0ef17f9 100644 --- a/src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj +++ b/src/nl/surf/eduhub_rio_mapper/endpoints/worker_api.clj @@ -17,7 +17,8 @@ ;; . (ns nl.surf.eduhub-rio-mapper.endpoints.worker-api - (:require [compojure.core :refer [GET]] + (:require [clojure.tools.logging :as log] + [compojure.core :refer [GET]] [compojure.route :as route] [nl.jomco.ring-trace-context :refer [wrap-trace-context]] [nl.surf.eduhub-rio-mapper.endpoints.app-server :as app-server] @@ -47,4 +48,5 @@ (defn serve-api [{{:keys [^Integer port host]} :worker-api-config :as config}] + (log/info (str "Starting worker api on port " port)) (app-server/run-jetty (make-app config) host port)) diff --git a/test/nl/surf/eduhub_rio_mapper/e2e_test.clj b/test/nl/surf/eduhub_rio_mapper/e2e_test.clj index 965d317c..e36a102d 100644 --- a/test/nl/surf/eduhub_rio_mapper/e2e_test.clj +++ b/test/nl/surf/eduhub_rio_mapper/e2e_test.clj @@ -25,6 +25,12 @@ (use-fixtures :once with-running-mapper remote-entities-fixture) +(deftest ^:e2e test-env-variables + (let [worker-api-port (System/getenv "WORKER_API_PORT")] + (if (nil? worker-api-port) + (println "WORKER_API_PORT is not set") + (println "WORKER_API_PORT is set to" worker-api-port)))) + (deftest ^:e2e create-edspecs-and-program (testing "create edspecs" (testing "scenario [1a]: Test /job/dry-run to see the difference between the edspec parent in OOAPI en de opleidingeenheid in RIO. You can expect RIO to be empty, when you start fresh."