Skip to content

Commit

Permalink
Check build schema against TeamCity output. #3
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgmer committed Feb 20, 2022
1 parent 34a0409 commit e730eb7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ See [BUILD_SERVERS.md](./BUILD_SERVERS.md) for detailed setup.

## JSON schema

[JSON Schema document](./schema.json)
[JSON Schema document](./resources/schema.json)

Example:

Expand Down
3 changes: 2 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
:aot [build-facts.main]
:jar-exclusions [#"docker/.*"]
:profiles {:dev {:dependencies [[clj-http-fake "1.0.3"]
[com.github.tomakehurst/wiremock "2.27.2"]]
[com.github.tomakehurst/wiremock "2.27.2"]
[luposlip/json-schema "0.3.3"]]
:plugins [[lein-ancient "1.0.0-RC3"]
[lein-nvd "1.9.0"]]}
:test {:resource-paths ["test/resources" "test/integration/teamcity-recording.jar"]}}
Expand Down
File renamed without changes.
11 changes: 9 additions & 2 deletions test/integration/teamcity_test.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(ns integration.teamcity-test
(:require [build-facts.main :as sut]
[cheshire.core :as j]
[clojure.test :refer :all])
[clojure.test :refer :all]
[json-schema.core :as schema])
(:import com.github.tomakehurst.wiremock.core.WireMockConfiguration
com.github.tomakehurst.wiremock.WireMockServer))

Expand Down Expand Up @@ -58,6 +59,12 @@
(filter :testResults)
(map :jobName)
dedupe
sort)))))
sort))))

(testing "has valid schema"
(let [build-schema (slurp (clojure.java.io/resource "schema.json"))]
(->> json-stream
(map #(schema/validate build-schema %))
doall))))

(.stop server)))

0 comments on commit e730eb7

Please sign in to comment.