Skip to content

Commit ce98af5

Browse files
Merge pull request #34 from clj-codes/feat/ops-health
feat: health endpoint
2 parents 740f6cf + d982181 commit ce98af5

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
(ns codes.clj.docs.backend.ports.http-in.ops)
2+
3+
(defn health
4+
[_]
5+
{:status 200 :body "OK"})

src/codes/clj/docs/backend/routes.clj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns codes.clj.docs.backend.routes
22
(:require [codes.clj.docs.backend.interceptors :as backend.interceptors]
33
[codes.clj.docs.backend.ports.http-in.document :as ports.http-in.document]
4+
[codes.clj.docs.backend.ports.http-in.ops :as ports.http-in.ops]
45
[codes.clj.docs.backend.ports.http-in.social :as ports.http-in.social]
56
[codes.clj.docs.backend.schemas.wire.in.social :as schemas.wire.in.social]
67
[codes.clj.docs.backend.schemas.wire.out.document :as schemas.wire.out.document]
@@ -15,6 +16,15 @@
1516
:description "codes.clj.docs.backend"}}
1617
:handler (swagger/create-swagger-handler)}}]
1718

19+
["/ops"
20+
{:swagger {:tags ["ops"]}}
21+
22+
["/health"
23+
{:get {:summary "health check"
24+
:responses {200 {:body :string}
25+
500 {:body :string}}
26+
:handler ports.http-in.ops/health}}]]
27+
1828
["/api"
1929

2030
["/login"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(ns integration.codes.clj.docs.backend.ops-test
2+
(:require [clojure.test :refer [use-fixtures]]
3+
[integration.codes.clj.docs.backend.util :as util]
4+
[parenthesin.helpers.malli :as helpers.malli]
5+
[parenthesin.helpers.state-flow.server.pedestal :as state-flow.server]
6+
[state-flow.api :refer [defflow flow]]
7+
[state-flow.assertions.matcher-combinators :refer [match?]]))
8+
9+
(use-fixtures :once helpers.malli/with-intrumentation)
10+
11+
(defflow
12+
flow-integration-ops-test
13+
{:init util/start-system!
14+
:cleanup util/stop-system!
15+
:fail-fast? true}
16+
(flow "should interact with system"
17+
(flow "health check"
18+
(match? {:status 200 :body "OK"}
19+
(state-flow.server/request! {:method :get
20+
:uri "/ops/health"})))))

0 commit comments

Comments
 (0)