You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ur...@apache.org on 2021/09/13 07:26:25 UTC

[airflow] 04/04: Fix Elastic tests depending on private function

This is an automated email from the ASF dual-hosted git repository.

uranusjr pushed a commit to branch aip-39-docs
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit f7383ef0c92bc11f63730b59e7d25ade701c37a0
Author: Tzu-ping Chung <tp...@astronomer.io>
AuthorDate: Mon Sep 13 15:20:34 2021 +0800

    Fix Elastic tests depending on private function
---
 airflow/providers/elasticsearch/log/es_task_handler.py    | 2 +-
 tests/providers/elasticsearch/log/test_es_task_handler.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/airflow/providers/elasticsearch/log/es_task_handler.py b/airflow/providers/elasticsearch/log/es_task_handler.py
index 1b69a8b..53c8358 100644
--- a/airflow/providers/elasticsearch/log/es_task_handler.py
+++ b/airflow/providers/elasticsearch/log/es_task_handler.py
@@ -281,7 +281,7 @@ class ElasticsearchTaskHandler(FileTaskHandler, ExternalLoggingMixin, LoggingMix
                 extras={
                     'dag_id': str(ti.dag_id),
                     'task_id': str(ti.task_id),
-                    'execution_date': self._clean_execution_date(ti.execution_date),
+                    'execution_date': self._clean_date(ti.execution_date),
                     'try_number': str(ti.try_number),
                     'log_id': self._render_log_id(ti, ti.try_number),
                 },
diff --git a/tests/providers/elasticsearch/log/test_es_task_handler.py b/tests/providers/elasticsearch/log/test_es_task_handler.py
index 004a8bc..604e5aa 100644
--- a/tests/providers/elasticsearch/log/test_es_task_handler.py
+++ b/tests/providers/elasticsearch/log/test_es_task_handler.py
@@ -43,7 +43,7 @@ class TestElasticsearchTaskHandler:
     TASK_ID = 'task_for_testing_es_log_handler'
     EXECUTION_DATE = datetime(2016, 1, 1)
     LOG_ID = f'{DAG_ID}-{TASK_ID}-2016-01-01T00:00:00+00:00-1'
-    JSON_LOG_ID = f'{DAG_ID}-{TASK_ID}-{ElasticsearchTaskHandler._clean_execution_date(EXECUTION_DATE)}-1'
+    JSON_LOG_ID = f'{DAG_ID}-{TASK_ID}-{ElasticsearchTaskHandler._clean_date(EXECUTION_DATE)}-1'
 
     @pytest.fixture()
     def ti(self, create_task_instance):
@@ -406,8 +406,8 @@ class TestElasticsearchTaskHandler:
         self.es_task_handler.json_format = True
         assert self.JSON_LOG_ID == self.es_task_handler._render_log_id(ti, 1)
 
-    def test_clean_execution_date(self):
-        clean_execution_date = self.es_task_handler._clean_execution_date(datetime(2016, 7, 8, 9, 10, 11, 12))
+    def test_clean_date(self):
+        clean_execution_date = self.es_task_handler._clean_date(datetime(2016, 7, 8, 9, 10, 11, 12))
         assert '2016_07_08T09_10_11_000012' == clean_execution_date
 
     @pytest.mark.parametrize(