Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Assert absent connection-spec keys instead of using `complement` (#79330)

Nemanja Glumac0bbd9658b05d
diff --git a/modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj b/modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj
index 5e22aa8ca98..56563b617da 100644
--- a/modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj
+++ b/modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj
@@ -737,27 +737,28 @@
(deftest can-change-from-password-test
(mt/test-driver
:snowflake
- (let [details (:details (mt/db))
+ ;; the test DB authenticates with a private key, so give it a password to switch away from
+ (let [details (assoc (:details (mt/db)) :password "test-password" :use-password true)
pk-key "testing"]
(is (=?
{:user some?
:password some?
- :private_key_file complement}
+ :private_key_file :hawk/key-not-present}
(sql-jdbc.conn/connection-details->spec :snowflake details)))
(is (=?
{:user some?
:password some?
- :private_key_file complement}
+ :private_key_file :hawk/key-not-present}
;; Before `use-password` password took precedence over a key file
(sql-jdbc.conn/connection-details->spec :snowflake (assoc details :private-key-value pk-key))))
(is (=?
{:user some?
- :password complement
+ :password :hawk/key-not-present
:private_key_file some?}
(sql-jdbc.conn/connection-details->spec :snowflake (assoc details :password nil :private-key-value pk-key))))
(is (=?
{:user some?
- :password complement
+ :password :hawk/key-not-present
:private_key_file some?}
(sql-jdbc.conn/connection-details->spec :snowflake (assoc details :use-password false :private-key-value pk-key)))))))
@@ -1186,7 +1187,7 @@
:details {:use-password false
:password "abc"}}]
(is (= {:password "abc" :use-password true} (:details db1)))
- (is (=? {:password "abc" :private-key-id int? :use-password complement} (:details db2)))
+ (is (=? {:password "abc" :private-key-id int? :use-password :hawk/key-not-present} (:details db2)))
(is (= {:password "abc" :use-password false} (:details db3)))))))
(deftest ^:parallel normalize-write-data-details-test