Skip to content

Commit

Permalink
Add spec test for port defaults for Postgres and MySQL
Browse files Browse the repository at this point in the history
  • Loading branch information
malthejorgensen committed Apr 1, 2019
1 parent 08aef10 commit a94f3bc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/metabase/db/spec_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
(assoc (default-pg-spec "") :dbname nil, :somethingrandom nil)
(db.spec/postgres
{:host "localhost"
:port 5432
:port nil
:dbname nil
:db nil
:somethingrandom nil}))
Expand All @@ -39,3 +39,17 @@
(expect
(default-pg-spec "")
(db.spec/postgres {}))

(defn- default-mysql-spec [db]
{:classname "org.mariadb.jdbc.Driver"
:subprotocol "mysql"
:subname (format "//localhost:3306/%s" db)})

;; Check that we default to port 3306 for MySQL databases, if `:port` is `nil`
(expect
(assoc (default-mysql-spec "") :dbname nil)
(db.spec/mysql
{:host "localhost"
:port nil
:dbname nil
:db nil}))

0 comments on commit a94f3bc

Please sign in to comment.