You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/07/22 14:15:16 UTC

[GitHub] [airflow] phanikumv opened a new pull request, #25235: Add test_connection to Azure Batch hook

phanikumv opened a new pull request, #25235:
URL: https://github.com/apache/airflow/pull/25235

   This PR enables the `Test connection` functionality for the Azure Batch Service connection type.
   
   <img width="1334" alt="Screenshot 2022-07-21 at 3 34 08 PM" src="https://user-images.githubusercontent.com/94376113/180458063-5daf6eb1-b6fd-4105-ba33-c1f04276de8e.png">
   
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] phanikumv commented on a diff in pull request #25235: Add test_connection to Azure Batch hook

Posted by GitBox <gi...@apache.org>.
phanikumv commented on code in PR #25235:
URL: https://github.com/apache/airflow/pull/25235#discussion_r927713115


##########
tests/providers/microsoft/azure/hooks/test_azure_batch.py:
##########
@@ -165,3 +166,20 @@ def test_add_single_task_to_job(self, mock_batch):
     def test_wait_for_all_task_to_complete(self, mock_batch):
         # TODO: Add test
         pass
+
+    @mock.patch('airflow.providers.microsoft.azure.hooks.batch.BatchServiceClient')
+    def test_connection_success(self, mock_batch):
+        hook = AzureBatchHook(azure_batch_conn_id=self.test_cloud_conn_id)
+        hook.get_conn().job.return_value = {}
+        status, msg = hook.test_connection()
+        print(status, msg)

Review Comment:
   Yes , removed it now..thanks !



##########
tests/providers/microsoft/azure/hooks/test_azure_batch.py:
##########
@@ -165,3 +166,20 @@ def test_add_single_task_to_job(self, mock_batch):
     def test_wait_for_all_task_to_complete(self, mock_batch):
         # TODO: Add test
         pass
+
+    @mock.patch('airflow.providers.microsoft.azure.hooks.batch.BatchServiceClient')
+    def test_connection_success(self, mock_batch):
+        hook = AzureBatchHook(azure_batch_conn_id=self.test_cloud_conn_id)
+        hook.get_conn().job.return_value = {}
+        status, msg = hook.test_connection()
+        print(status, msg)

Review Comment:
   Yes , removed it now..thanks !



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] josh-fell merged pull request #25235: Add test_connection to Azure Batch hook

Posted by GitBox <gi...@apache.org>.
josh-fell merged PR #25235:
URL: https://github.com/apache/airflow/pull/25235


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] josh-fell commented on a diff in pull request #25235: Add test_connection to Azure Batch hook

Posted by GitBox <gi...@apache.org>.
josh-fell commented on code in PR #25235:
URL: https://github.com/apache/airflow/pull/25235#discussion_r927701198


##########
tests/providers/microsoft/azure/hooks/test_azure_batch.py:
##########
@@ -165,3 +166,20 @@ def test_add_single_task_to_job(self, mock_batch):
     def test_wait_for_all_task_to_complete(self, mock_batch):
         # TODO: Add test
         pass
+
+    @mock.patch('airflow.providers.microsoft.azure.hooks.batch.BatchServiceClient')
+    def test_connection_success(self, mock_batch):
+        hook = AzureBatchHook(azure_batch_conn_id=self.test_cloud_conn_id)
+        hook.get_conn().job.return_value = {}
+        status, msg = hook.test_connection()
+        print(status, msg)

Review Comment:
   ```suggestion
   ```
   Some leftovers from local dev?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org