You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by el...@apache.org on 2022/03/06 15:17:57 UTC

[airflow] branch main updated: Fix failing main after merging SFTP hook test connection (#22026)

This is an automated email from the ASF dual-hosted git repository.

eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 76150f1  Fix failing main after merging SFTP hook test connection (#22026)
76150f1 is described below

commit 76150f172e99c266740cab70cc80266cab17f48f
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun Mar 6 16:17:02 2022 +0100

    Fix failing main after merging SFTP hook test connection (#22026)
    
    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(-)

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 4dad75f..b2f6b1e 100644
--- a/tests/models/test_connection.py
+++ b/tests/always/test_connection.py
@@ -674,14 +674,14 @@ class TestConnection(unittest.TestCase):
     @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'):