Implement ssh tunnel reconnection (#14563)
* Implement ssh tunnel reconnection From the connection-with-timezone method of execute, check whether an ssh tunnel that should be open actually is not, and if so, mark the entire pool as invalid (thereby forcing the connection code to rebuild the source and open a new tunnel) Fixing the create-pool! function so that the relevant ssh tunnel entries are kept (in addition to the :datasource) Adding test in ssh-test namespace, which will test that the tunnel is reestablished (for now, running with Postgres driver) * Responding to PR feedback from Dan * Fixing test by adding AcceptAllForwardingFilter forwardingFilter to the mock password server instance * Change with-driver to test-driver * Add ssh tunnel reconnect test that can run against H2 * Implement ssh tunnel reconnection From the connection-with-timezone method of execute, check whether an ssh tunnel that should be open actually is not, and if so, mark the entire pool as invalid (thereby forcing the connection code to rebuild the source and open a new tunnel) Fixing the create-pool! function so that the relevant ssh tunnel entries are kept (in addition to the :datasource) Adding test in ssh-test namespace, which will test that the tunnel is reestablished (for now, running with Postgres driver) * Responding to PR feedback from Dan * Fixing test by adding AcceptAllForwardingFilter forwardingFilter to the mock password server instance * Rebase again to fix merge conflict * Change test-driver to with-driver in hopes of making CodeCov finally happy * Adding new multimethod to ssh namespace, called incorporate-ssh-tunnel-details, for accounting for the Implementing incorporate-ssh-tunnel-details for h2 so update the URI string (:db key) to point to the tunnel entry point Pulled logic for :sql-jdbc implementation of connection-with-timezone out to a new fn, so it can be called elsewhere Updating H2 reconnection test imn light of the changes above Added "!" suffix to name of include-ssh-tunnel to reflect the fact that it does modify global state * Fixing NPE in incorporate-ssh-tunnel-details implementation for :h2 Moving multimethod declaration for incorporate-ssh-tunnel-details to driver namespace * Fix :h2 implementation again * Remove another errant extra line :( * Rebase onto master * Inline the private helper fn back into connection-with-timezone * Remove dead code
Showing
- modules/drivers/oracle/src/metabase/driver/oracle.clj 1 addition, 1 deletionmodules/drivers/oracle/src/metabase/driver/oracle.clj
- src/metabase/driver.clj 8 additions, 0 deletionssrc/metabase/driver.clj
- src/metabase/driver/h2.clj 14 additions, 1 deletionsrc/metabase/driver/h2.clj
- src/metabase/driver/impl.clj 1 addition, 1 deletionsrc/metabase/driver/impl.clj
- src/metabase/driver/sql_jdbc/connection.clj 32 additions, 8 deletionssrc/metabase/driver/sql_jdbc/connection.clj
- src/metabase/util/ssh.clj 25 additions, 3 deletionssrc/metabase/util/ssh.clj
- test/metabase/util/ssh_test.clj 104 additions, 16 deletionstest/metabase/util/ssh_test.clj
- test_resources/ssh/tiny-db.mv.db 0 additions, 0 deletionstest_resources/ssh/tiny-db.mv.db
test_resources/ssh/tiny-db.mv.db
0 → 100644
File added
Please register or sign in to comment