                               (let [serial-number (next-serial-number! serial-file)]
                                 (swap! serials conj serial-number)))
                             (deliver p 'done))
-                          p))]
+                          p))
+
+          contains-duplicates? #(not= (count %) (count (distinct %)))]
 
       ; wait on all the threads to finish
       (doseq [p promises] (deref p))

        (assert-no-autosign "this-THAT-")))

    (testing "domain-name globs"
      (doto (tmp-whitelist "*.red"
                           "*.black.local"
                           "*.UPPER.case")
        (assert-autosign "red")
        (assert-autosign ".red")
        (assert-autosign "green.red")

(defn assert-issuer [o issuer]
  (is (= issuer (-> o .getIssuerX500Principal .getName))))

(defn tmp-whitelist! [& lines]
  (let [whitelist (ks/temp-file)]
    (doseq [line lines]
      (spit whitelist (str line "\n") :append true))
    (str whitelist)))

(defn tmp-serial-file! []
  (doto (str (ks/temp-file))
    initialize-serial-file!))

(def empty-stream-fn #(ByteArrayInputStream. (.getBytes "")))

