amoghrajesh commented on code in PR #69450:
URL: https://github.com/apache/airflow/pull/69450#discussion_r3528842396


##########
providers/snowflake/tests/unit/snowflake/operators/test_snowflake.py:
##########
@@ -359,6 +359,49 @@ def 
test_poll_on_queries_raises_runtime_error_on_status_check_failure(
         with pytest.raises(RuntimeError, match="Failed to get status for query 
uuid1"):
             operator.poll_on_queries()
 
+    def test_poll_on_queries_no_sleep_when_all_resolved(
+        self, mock_execute_query, mock_get_sql_api_query_status
+    ):
+        operator = SnowflakeSqlApiOperator(
+            task_id=TASK_ID,
+            snowflake_conn_id="snowflake_default",
+            sql=SQL_MULTIPLE_STMTS,
+            statement_count=4,
+            do_xcom_push=False,
+        )
+        operator.query_ids = ["uuid1", "uuid2"]
+        mock_get_sql_api_query_status.side_effect = [{"status": "success"}, 
{"status": "error"}]
+
+        with mock.patch("time.sleep") as mock_sleep:
+            result = operator.poll_on_queries()
+
+        mock_sleep.assert_not_called()
+        assert result["success"] == {"uuid1": {"status": "success"}}
+        assert result["error"] == {"uuid2": {"status": "error"}}
+        assert result["running"] == {}
+
+    def test_poll_on_queries_sleeps_once_per_cycle(self, mock_execute_query, 
mock_get_sql_api_query_status):

Review Comment:
   Handled in 7b43a636bb



##########
providers/snowflake/tests/unit/snowflake/operators/test_snowflake.py:
##########
@@ -359,6 +359,49 @@ def 
test_poll_on_queries_raises_runtime_error_on_status_check_failure(
         with pytest.raises(RuntimeError, match="Failed to get status for query 
uuid1"):
             operator.poll_on_queries()
 
+    def test_poll_on_queries_no_sleep_when_all_resolved(
+        self, mock_execute_query, mock_get_sql_api_query_status
+    ):

Review Comment:
   Handled in 7b43a636bb



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to