From 1b5fc18cf2bf932ba27342018748511be681506f Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sun, 6 Mar 2022 15:28:32 +0100 Subject: [PATCH] Fix failing main after merging SFTP hook test connection The #21997 implemented test_connection method in FTP hook, but we were using FTP hook to actually test .... what happens when the test_connection method was missing :) Unfortunately the test for it was not run because the "core" tests are skipped in case only provider change :(. This PR switches the test_connection missing test to use GRPC hook (it does not have the test_connection method) and moves the whole test_connection.py to "always" category of tests that are always executed - there are more tests there that have some assumptions on the existing connections and having the tests executed "always" makes sense to avoid similar problems in the future. --- tests/{models => always}/test_connection.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename tests/{models => always}/test_connection.py (99%) diff --git a/tests/models/test_connection.py b/tests/always/test_connection.py similarity index 99% rename from tests/models/test_connection.py rename to tests/always/test_connection.py index 4dad75fc82d54..b2f6b1e91651a 100644 --- a/tests/models/test_connection.py +++ b/tests/always/test_connection.py @@ -674,14 +674,14 @@ def test_connection_test_no_hook(self): @mock.patch.dict( 'os.environ', { - 'AIRFLOW_CONN_TEST_URI_HOOK_METHOD_MISSING': 'ftp://', + 'AIRFLOW_CONN_TEST_URI_HOOK_METHOD_MISSING': 'grpc://', }, ) def test_connection_test_hook_method_missing(self): - conn = Connection(conn_id='test_uri_hook_method_mising', conn_type='ftp') + conn = Connection(conn_id='test_uri_hook_method_missing', conn_type='grpc') res = conn.test_connection() assert res[0] is False - assert res[1] == "Hook FTPHook doesn't implement or inherit test_connection method" + assert res[1] == "Hook GrpcHook doesn't implement or inherit test_connection method" def test_extra_warnings_non_json(self): with pytest.warns(DeprecationWarning, match='non-JSON'):