Skip to content

Pull in generative testing deps #3

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(defproject com.unbounce/clojure-dogstatsd-client "0.1.1"
(defproject com.unbounce/clojure-dogstatsd-client "0.1.2-SNAPSHOT"
:description "A thin veneer over java-dogstatsd-client"
:url "https://github.com/unbounce/clojure-dogstatsd-client"
:license {:name "The MIT License (MIT)"
:url "http://opensource.org/licenses/MIT"
:license {:name "The MIT License (MIT)"
:url "http://opensource.org/licenses/MIT"
:comments "Copyright (c) 2018 Unbounce Marketing Solutions Inc."}
:profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0"]]}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still relevant as generative testing rely on this dependency.

:dependencies [[org.clojure/clojure "1.9.0"]
[com.datadoghq/java-dogstatsd-client "2.5"]]
:global-vars {*warn-on-reflection* true})
25 changes: 9 additions & 16 deletions test/com/unbounce/dogstatsd/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,32 @@
[clojure.spec.test.alpha :as stest]))

(s/def ::sample-rate number?)
(s/def ::tags (s/coll-of string?))
(s/def ::metric string?)
(s/def ::tags (s/coll-of string? :kind vector?))
(s/def ::opts (s/keys :req-un [::tags ::sample-rate]))
(s/def ::opts* (s/keys* :req-un [::tags ::sample-rate]))
Copy link
Contributor Author

@gzmask gzmask Feb 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also nice to have for (f :key 'value') compare to (f {:key 'value}) .
But agrees that we should only be using one and not both styles.


(s/fdef sut/str-array
:args (s/cat :tags ::tags)
:args (s/or :tags (s/cat :tags ::tags)
:no-tag (s/cat :tags nil?))
:ret #(instance? java.lang.Object %))

(s/fdef sut/increment
:args (s/cat :metric string?
:opts (s/* (s/alt :_ (s/cat :_ (partial = :tags)
:_ ::tags)
:_ (s/cat :_ (partial = :sample-rate)
:_ ::sample-rate))))
:args (s/cat :metric ::metric
:opts ::opts*)
:ret nil?)

(s/fdef sut/decrement
:args (s/cat :metric string?
:opts (s/* (s/alt :_ (s/cat :_ (partial = :tags)
:_ ::tags)
:_ (s/cat :_ (partial = :sample-rate)
:_ ::sample-rate))))
:args (s/cat :metric ::metric
:opts ::opts*)
:ret nil?)


(s/fdef sut/gauge
:args (s/cat :metric string?
:value number?
:opts ::opts)
:ret nil?)


(s/fdef sut/histogram
:args (s/cat :metric string?
:value number?
Expand All @@ -50,8 +45,6 @@
(stest/instrument `sut/gauge)
(stest/instrument `sut/histogram)

(sut/setup!)

(stest/check `sut/str-array)
(stest/check `sut/increment)
(stest/check `sut/decrement)
Expand Down