Skip to content

Fix unreachable success log in EksDeleteClusterOperator.execute_complete - #73109

Open
abhinav-phi wants to merge 1 commit into
apache:mainfrom
abhinav-phi:fix/eks-delete-cluster-trigger-status
Open

abhinav-phi wants to merge 1 commit into
apache:mainfrom
abhinav-phi:fix/eks-delete-cluster-trigger-status

Conversation

@abhinav-phi

Copy link
Copy Markdown

Sub-item of #72982 (EKS trigger/operator status mismatch).

Root cause: EksDeleteClusterTrigger yields {"status": "deleted"} when the cluster is gone, but EksDeleteClusterOperator.execute_complete only logs the success message when the status is "success" — so the "Cluster deleted successfully." log line was unreachable. The trigger's other consumer, EksCreateClusterOperator.execute_failed, already checks for "deleted" correctly, which is why the fix goes on the operator side: changing the trigger's yielded status would break that path.

Changes

  • providers/amazon/src/airflow/providers/amazon/aws/operators/eks.py: accept the "deleted" status the trigger actually yields.
  • providers/amazon/tests/unit/amazon/aws/operators/test_eks.py: test_execute_complete_when_trigger_yields_deleted asserts the success log fires for the trigger's real event.

Testing

  • The new test fails on the old code and passes on the new code.
  • TestEksDeleteClusterOperator (9 tests) + the full EKS trigger suite (tests/unit/amazon/aws/triggers/test_eks.py, 18 tests): 27 passed locally.
  • ruff check and ruff format --check clean on both files.

I checked the other EKS trigger/operator pairs (create cluster/nodegroup/fargate profile, delete nodegroup/fargate profile): their AwsBaseWaiterTrigger events carry "success"/"error" and the operators match, so this was the only mismatch in the EKS family.

@boring-cyborg

boring-cyborg Bot commented Sep 13, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example Dag that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Sep 13, 2026

@Vamsi-klu Vamsi-klu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def test_execute_complete_when_trigger_yields_deleted(self, caplog):
# EksDeleteClusterTrigger yields {"status": "deleted"}, not "success".
self.delete_cluster_operator.execute_complete(context={}, event={"status": "deleted"})
assert "Cluster deleted successfully." in caplog.messages

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — switched to the structured-membership assertion: assert "Cluster deleted successfully." in caplog (exact match on the captured event field, since caplog is backed by the StructlogCapture fixture now). All 9 tests in the class pass locally; amended into the single commit and rebased onto main. Thanks!

@abhinav-phi
abhinav-phi force-pushed the fix/eks-delete-cluster-trigger-status branch from 46bba12 to 66bb7ed Compare September 14, 2026 17:15
def test_execute_complete_when_trigger_yields_deleted(self, caplog):
# EksDeleteClusterTrigger yields {"status": "deleted"}, not "success".
self.delete_cluster_operator.execute_complete(context={}, event={"status": "deleted"})
assert "Cluster deleted successfully." in caplog.messages

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — switched to the structured-membership assertion: assert "Cluster deleted successfully." in caplog (exact match on the captured event field, since caplog is backed by the StructlogCapture fixture now). All 9 tests in the class pass locally; amended into the single commit and rebased onto main. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants