ephraimbuddy commented on a change in pull request #14254: URL: https://github.com/apache/airflow/pull/14254#discussion_r583895748
########## File path: tests/providers/microsoft/azure/transfers/test_sftp_to_wasb_system.py ########## @@ -0,0 +1,66 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +import os + +import pytest + +from airflow.providers.microsoft.azure.example_dags.example_sftp_to_wasb import ( + AZURE_CONTAINER_NAME, + BLOB_PREFIX, + FILE_COMPLETE_PATH, + LOCAL_FILE_PATH, + SAMPLE_FILE_NAME, + SFTP_FILE_COMPLETE_PATH, +) +from airflow.providers.microsoft.azure.hooks.wasb import WasbHook +from airflow.providers.sftp.hooks.sftp import SFTPHook +from tests.test_utils.azure_system_helpers import ( + AZURE_DAG_FOLDER, + AzureSystemTest, + provide_wasb_default_connection, +) +from tests.test_utils.sftp_system_helpers import provide_sftp_default_connection + +CREDENTIALS_DIR = os.environ.get('CREDENTIALS_DIR', '/files/airflow-breeze-config/keys') +SFTP_DEFAULT_KEY = 'sftp_key.json' +WASB_DEFAULT_KEY = 'wasb_key.json' +CREDENTIALS_SFTP_PATH = os.path.join(CREDENTIALS_DIR, SFTP_DEFAULT_KEY) +CREDENTIALS_WASB_PATH = os.path.join(CREDENTIALS_DIR, WASB_DEFAULT_KEY) + + [email protected]('postgres', 'mysql') [email protected]_file(WASB_DEFAULT_KEY) [email protected]_file(SFTP_DEFAULT_KEY) +class TestSFTPToWasbSystem(AzureSystemTest): + def setUp(self): + super().setUp() + self.create_dummy_file(SAMPLE_FILE_NAME, LOCAL_FILE_PATH) + + def tearDown(self): + os.remove(FILE_COMPLETE_PATH) + super().tearDown() + + @provide_wasb_default_connection(CREDENTIALS_WASB_PATH) + @provide_sftp_default_connection(CREDENTIALS_SFTP_PATH) + def test_run_example_file_to_wasb(self): + self.run_dag('example_sftp_to_wasb', AZURE_DAG_FOLDER) + WasbHook(wasb_conn_id="wasb_default").delete_file( + AZURE_CONTAINER_NAME, BLOB_PREFIX + SAMPLE_FILE_NAME + ) + SFTPHook(ssh_conn_id="sftp_default").delete_file(SFTP_FILE_COMPLETE_PATH) Review comment: Can you delete as suggested above now that you have implemented in example dags ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
