You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "o-nikolas (via GitHub)" <gi...@apache.org> on 2023/03/04 00:16:58 UTC

[GitHub] [airflow] o-nikolas commented on a diff in pull request #29732: Loop through paginated response to check for cluster id

o-nikolas commented on code in PR #29732:
URL: https://github.com/apache/airflow/pull/29732#discussion_r1125153517


##########
tests/providers/amazon/aws/hooks/test_emr.py:
##########
@@ -181,6 +182,11 @@ def test_get_cluster_id_by_name(self):
             {"Name": "test_cluster", "Instances": {"KeepJobFlowAliveWhenNoSteps": True}}
         )
 
+        for i in range(51):
+            hook.create_job_flow(
+                {"Name": "test_cluster" + str(i % 50), "Instances": {"KeepJobFlowAliveWhenNoSteps": True}}

Review Comment:
   Did you use `i % 50` so that the 0 case would be in the list twice? If so it's a bit sneaky and non-obvious IMHO.



##########
tests/providers/amazon/aws/hooks/test_emr.py:
##########
@@ -191,6 +197,9 @@ def test_get_cluster_id_by_name(self):
 
         assert no_match is None
 
+        with pytest.raises(AirflowException):
+            hook.get_cluster_id_by_name("test_cluster0", ["RUNNING", "WAITING", "BOOTSTRAPPING"])
+

Review Comment:
   Should you not add a test case which covers the issue this PR is solving? I.e. A success case for getting a cluster id for a cluster that would be on the second page.



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