jayamanikharyono commented on code in PR #69382:
URL: https://github.com/apache/airflow/pull/69382#discussion_r3612153684


##########
providers/tableau/tests/unit/tableau/operators/test_tableau.py:
##########
@@ -530,3 +535,144 @@ def 
test_blocking_refresh_forwards_wait_for_state_options(self, mock_tableau_hoo
             exponential_backoff=True,
             max_check_interval=120,
         )
+
+    @patch("airflow.providers.tableau.operators.tableau.TableauHook")
+    def test_resource_refresh_skip_on_conflict_raises_skip_exception(self, 
mock_tableau_hook):
+        """
+        Test that a 409093 Resource Conflict on a Tableau resource refresh is 
turned into an
+        AirflowSkipException when skip_on_conflict=True.
+        """
+        mock_tableau_hook.get_all = Mock(return_value=self.mock_datasources)
+        mock_tableau_hook.return_value.__enter__ = 
Mock(return_value=mock_tableau_hook)
+        mock_tableau_hook.server.datasources.refresh.side_effect = 
ServerResponseError(
+            "409093", "Resource Conflict", "Job is already queued. Not queuing 
a duplicate."
+        )
+
+        operator = TableauOperator(
+            find="ds_2",
+            resource="datasources",
+            skip_on_conflict=True,
+            **self.kwargs,
+        )
+
+        with pytest.raises(AirflowSkipException):
+            operator.execute(context={})
+
+    @patch("airflow.providers.tableau.operators.tableau.TableauHook")
+    def 
test_incremental_resource_refresh_skip_on_conflict_raises_skip_exception(self, 
mock_tableau_hook):

Review Comment:
   > Good start!
   > 
   > Are there tests for when `incremental_refresh == True`? Since there are 
changes there, I'd recommend adding those tests.
   
   Thanks for the suggestion. I've added tests for the `incremental_refresh == 
True` scenario to cover the conflict handling behavior for incremental refresh 
as well.
   
   The new tests verify that when Tableau returns a `409093 Resource Conflict`, 
the task is skipped instead of failing.



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