You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by am...@apache.org on 2025/07/25 07:16:35 UTC
(airflow) branch main updated: Making some brittle tests related to log assertion more robust (#53743)
This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new bc28c15562c Making some brittle tests related to log assertion more robust (#53743)
bc28c15562c is described below
commit bc28c15562c0ca56b3296f40ebb761359b49e2c1
Author: Amogh Desai <am...@gmail.com>
AuthorDate: Fri Jul 25 12:46:28 2025 +0530
Making some brittle tests related to log assertion more robust (#53743)
---
.../unit/cncf/kubernetes/sensors/test_spark_kubernetes.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py
index d5cfde025fb..16d89033607 100644
--- a/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py
+++ b/providers/cncf/kubernetes/tests/unit/cncf/kubernetes/sensors/test_spark_kubernetes.py
@@ -18,7 +18,7 @@
from __future__ import annotations
import json
-from unittest.mock import patch
+from unittest.mock import call, patch
import pytest
from kubernetes.client.rest import ApiException
@@ -841,9 +841,7 @@ class TestSparkKubernetesSensor:
mock_log_call.assert_called_once_with(
"spark-pi-2020-02-24-1-driver", namespace="default", container="spark-kubernetes-driver"
)
- log_info_call = info_log_call.mock_calls[2]
- log_value = log_info_call[1][0]
- assert log_value == TEST_POD_LOG_RESULT
+ assert call(TEST_POD_LOG_RESULT) in info_log_call.mock_calls
@patch(
"kubernetes.client.api.custom_objects_api.CustomObjectsApi.get_namespaced_custom_object",
@@ -888,6 +886,4 @@ class TestSparkKubernetesSensor:
mock_log_call.assert_called_once_with(
"spark-pi-2020-02-24-1-driver", namespace="default", container="spark-kubernetes-driver"
)
- log_info_call = info_log_call.mock_calls[2]
- log_value = log_info_call[1][0]
- assert log_value == TEST_POD_LOG_RESULT
+ assert call(TEST_POD_LOG_RESULT) in info_log_call.mock_calls