Skip to content

Commit

Permalink
Run worker web API on different port in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remvee authored and mdemare committed May 14, 2024
1 parent c6ee695 commit b936f2d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ must be set:
```
API_HOSTNAME Hostname for listing web API
API_PORT HTTP port for serving web API
WORKER_HOSTNAME Hostname for listing worker web API
WORKER_PORT HTTP port for serving werker web API
CLIENTS_INFO_PATH CLients info config file
GATEWAY_PASSWORD OOAPI Gateway Password
GATEWAY_ROOT_URL OOAPI Gateway Root URL
Expand Down
48 changes: 25 additions & 23 deletions src/nl/surf/eduhub_rio_mapper/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -163,30 +163,32 @@
config))

(defn make-config
[]
{:post [(some? (-> % :rio-config :credentials :certificate))]}
(let [[config errs] (envopts/opts env opts-spec)]
([]
(make-config env))
([env]
{:post [(some? (-> % :rio-config :credentials :certificate))]}
(let [[config errs] (envopts/opts env opts-spec)]

(when errs
(.println *err* "Configuration error")
(.println *err* (envopts/errs-description errs))
(System/exit 1))
(let [{:keys [clients-info-config
keystore
keystore-pass
keystore-alias
trust-store
trust-store-pass] :as cfg}
(reduce load-secret-from-file config (vals key-value-pairs-with-optional-secret-files))]
(-> cfg
(validate-required-secrets)
(assoc-in [:rio-config :credentials]
(keystore/credentials keystore
keystore-pass
keystore-alias
trust-store
trust-store-pass))
(assoc :clients (clients-info/read-clients-data clients-info-config))))))
(when errs
(.println *err* "Configuration error")
(.println *err* (envopts/errs-description errs))
(System/exit 1))
(let [{:keys [clients-info-config
keystore
keystore-pass
keystore-alias
trust-store
trust-store-pass] :as cfg}
(reduce load-secret-from-file config (vals key-value-pairs-with-optional-secret-files))]
(-> cfg
(validate-required-secrets)
(assoc-in [:rio-config :credentials]
(keystore/credentials keystore
keystore-pass
keystore-alias
trust-store
trust-store-pass))
(assoc :clients (clients-info/read-clients-data clients-info-config)))))))

(defn make-config-and-handlers []
(let [{:keys [clients] :as cfg} (make-config)
Expand Down
2 changes: 1 addition & 1 deletion test/nl/surf/eduhub_rio_mapper/e2e_helper.clj
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@

;; Defer running make-config so running some (other!) tests is still
;; possible when environment incomplete.
(def config (delay (config/make-config)))
(def config (delay (config/make-config (assoc env "WORKER_API_PORT" "8081"))))

(def base-url
(delay (str "http://"
Expand Down

0 comments on commit b936f2d

Please sign in to comment.