File tree Expand file tree Collapse file tree 5 files changed +30
-2
lines changed
Expand file tree Collapse file tree 5 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -196,4 +196,3 @@ shards:
196196 yaml_mapping:
197197 git: https://github.com/crystal-lang/yaml_mapping.cr.git
198198 version: 0.1.1
199-
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ dependencies:
4747
4848 placeos-models :
4949 github : placeos/models
50- version : ~> 5.0
50+ version : ~> 5.3
5151
5252 placeos-resource :
5353 github : place-labs/resource
Original file line number Diff line number Diff line change 1+ require " ../helper"
2+
3+ module PlaceOS::Core::Api
4+ with_server do
5+ it " health checks" do
6+ result = curl(" GET" , " /api/core/v1/" )
7+ result.status_code.should eq 200
8+ end
9+ it " should check version" do
10+ result = curl(" GET" , " /api/core/v1/version" )
11+ result.status_code.should eq 200
12+ PlaceOS ::Model ::Version .from_json(result.body).service.should eq " core"
13+ end
14+ end
15+ end
Original file line number Diff line number Diff line change 11require " ./application"
2+ require " placeos-models/version"
23
34require " rethinkdb"
45require " rethinkdb-orm"
@@ -17,6 +18,15 @@ module PlaceOS::Core::Api
1718 head self .class.healthcheck? ? HTTP ::Status ::OK : HTTP ::Status ::INTERNAL_SERVER_ERROR
1819 end
1920
21+ get " /version" , :version do
22+ render :ok , json: PlaceOS ::Model ::Version .new(
23+ version: VERSION ,
24+ build_time: BUILD_TIME ,
25+ commit: BUILD_COMMIT ,
26+ service: APP_NAME
27+ )
28+ end
29+
2030 def self.healthcheck ? : Bool
2131 Promise .all(
2232 Promise .defer {
Original file line number Diff line number Diff line change @@ -213,6 +213,10 @@ module PlaceOS::Core
213213 CoreStatus .from_json(response.body)
214214 end
215215
216+ def version : PlaceOS ::Model ::Version
217+ PlaceOS ::Model ::Version .from_json(get(" /version" ).body)
218+ end
219+
216220 struct Load < BaseResponse
217221 getter local : SystemLoad
218222 getter edge : Hash (String , SystemLoad )
You can’t perform that action at this time.
0 commit comments