potiuk commented on a change in pull request #7261: [AIRFLOW-6641] Better 
diagnostics for kubernetes flaky tests
URL: https://github.com/apache/airflow/pull/7261#discussion_r370962245
 
 

 ##########
 File path: tests/runtime/kubernetes/test_kubernetes_executor.py
 ##########
 @@ -92,18 +96,39 @@ def monitor_task(self, host, execution_date, dag_id, 
task_id, expected_final_sta
                 tries += 1
             except requests.exceptions.ConnectionError as e:
                 check_call(["echo", "api call failed. trying again. error 
{}".format(e)])
-
+        if state != expected_final_state:
+            print("The expected state is wrong {} != {} 
(expected)!".format(state, expected_final_state))
+            self.dump_kubernetes_logs()
         self.assertEqual(state, expected_final_state)
 
-        # Maybe check if we can retrieve the logs, but then we need to extend 
the API
+    def dump_kubernetes_logs(self):
+        if os.environ.get('ENABLE_KIND_CLUSTER') == 'true':
+            self.dump_kind_logs()
+
+    def dump_kind_logs(self):
+        tempdir_path = mkdtemp()
 
 Review comment:
   I want to cherry-pick it to 1.10  - with python 2.7 support, I considered 
TemporaryDirectory - but it won't work there I am afraid .

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to