         [com.puppetlabs.cmdb.scf.migrate :only [migrate!]]
         [clojure.test]
         [clojure.math.combinatorics :only (combinations)]
+        [clj-time.core :only [now]]
+        [clj-time.coerce :only [to-timestamp]]
         [com.puppetlabs.jdbc :only [query-to-vec]]
         [com.puppetlabs.cmdb.testutils :only [test-db]]))
 

                prev-new-num  (.count (:new-catalog metrics))]

            ;; Do an initial replacement with the same catalog
            (replace-catalog! catalog (java.util.Date.))
            (is (= 1 (- (.count (:duplicate-catalog metrics)) prev-dupe-num)))
            (is (= 0 (- (.count (:new-catalog metrics)) prev-new-num)))

            ;; Store a second catalog, with the same content save the version
            (replace-catalog! (assoc catalog :version "abc123") (java.util.Date.))
            (is (= 2 (- (.count (:duplicate-catalog metrics)) prev-dupe-num)))
            (is (= 0 (- (.count (:new-catalog metrics)) prev-new-num)))


        (migrate!)
        (add-certname! certname)
        (let [hash (add-catalog! catalog)]
          (associate-catalog-with-certname! hash certname (now)))

        (testing "should contain proper catalog metadata"
          (is (= (query-to-vec ["SELECT cr.certname, c.api_version, c.catalog_version FROM catalogs c, certname_catalogs cr WHERE cr.catalog=c.hash"])
