Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(SERVER-450) Add proper semver parsing to unit tests #451

Merged
merged 2 commits into from Mar 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion project.clj
Expand Up @@ -88,7 +88,8 @@
[puppetlabs/kitchensink ~ks-version :classifier "test" :scope "test"]
[ring-basic-authentication "1.0.5"]
[ring-mock "0.1.5"]
[spyscope "0.1.4" :exclusions [clj-time]]]
[spyscope "0.1.4" :exclusions [clj-time]]
[grimradical/clj-semver "0.2.0" :exclusions [org.clojure/clojure]]]
:injections [(require 'spyscope.core)]
; SERVER-332, enable SSLv3 for unit tests that exercise SSLv3
:jvm-opts ["-Djava.security.properties=./dev-resources/java.security"]}
Expand Down
Expand Up @@ -12,7 +12,8 @@
[puppetlabs.trapperkeeper.services.webserver.jetty9-service :refer [jetty9-service]]
[puppetlabs.trapperkeeper.testutils.bootstrap :as tk-testutils]
[puppetlabs.trapperkeeper.testutils.logging :refer [with-test-logging]]
[puppetlabs.services.jruby.jruby-testutils :as jruby-testutils]))
[puppetlabs.services.jruby.jruby-testutils :as jruby-testutils]
[clj-semver.core :as semver]))

(def service-and-deps
[puppet-server-config-service jruby-puppet-pooled-service jetty9-service
Expand All @@ -28,8 +29,10 @@
(assoc-in [:jruby-puppet :master-conf-dir]
(str test-resources-dir "/master/conf"))))

(defn valid-semver-number? [v]
(re-matches #"[0-9]\.[0-9]\.[0-9]" v))
(defn valid-semver-number? [s]
(if (try (semver/valid-format? s)
(catch IllegalArgumentException e))
true false))

(deftest config-service-functions
(tk-testutils/with-app-with-config
Expand Down