Skip to content
Snippets Groups Projects
Unverified Commit b0746b40 authored by Jeff Evans's avatar Jeff Evans Committed by GitHub
Browse files

Typo in connection pool diagnostic JSON download (#16599)

Fix typo in DS name for app DB

Add test assertion
parent af704d35
Branches
Tags
No related merge requests found
......@@ -26,7 +26,7 @@
(s/defn ^:private connection-pool-spec :- {:datasource javax.sql.DataSource, s/Keyword s/Any}
[db-type :- s/Keyword jdbc-spec :- (s/cond-pre s/Str su/Map)]
(let [ds-name (format "metatabase-%s-app-db" (name db-type))
(let [ds-name (format "metabase-%s-app-db" (name db-type))
pool-props (assoc application-db-connection-pool-props "dataSourceName" ds-name)]
(if (string? jdbc-spec)
{:datasource (connection-pool/pooled-data-source-from-url jdbc-spec pool-props)}
......
......@@ -4,14 +4,18 @@
[metabase
[connection-pool :as connection-pool]
[test :as mt]]
[metabase.db.connection-pool-setup :as mdb.connection-pool-setup]))
[metabase.db.connection-pool-setup :as mdb.connection-pool-setup])
(:import com.mchange.v2.c3p0.PoolBackedDataSource))
(deftest connection-pool-spec-test
(testing "Should be able to create a connection pool"
(letfn [(test* [db-type spec]
(let [{:keys [datasource], :as spec} (#'mdb.connection-pool-setup/connection-pool-spec db-type spec)]
(let [conn-pool-spec (#'mdb.connection-pool-setup/connection-pool-spec db-type spec)
{:keys [^PoolBackedDataSource datasource], :as spec} conn-pool-spec]
(try
(is (instance? javax.sql.DataSource datasource))
(is (= (format "metabase-%s-app-db" (name db-type))
(.getDataSourceName datasource)))
(is (= [{:one 1}]
(jdbc/query spec ["SELECT 1 AS one;"])))
(finally
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment