You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/24 08:30:06 UTC

[GitHub] [airflow] potiuk opened a new issue #11816: [QUARANTINE] Flaky test TestPostClearTaskInstances.test_should_response_200_with_reset_dag_run

potiuk opened a new issue #11816:
URL: https://github.com/apache/airflow/issues/11816


   Flaky test here: 
   
   TestPostClearTaskInstances.test_should_response_200_with_reset_dag_run
   
   https://github.com/apache/airflow/pull/11809/checks?check_run_id=1301036003#step:6:1336
   
   Looks like an easy to fix by allowing rows returned in reverse order as well
   
   ```
   ____ TestPostClearTaskInstances.test_should_response_200_with_reset_dag_run ____
   
   self = <tests.api_connexion.endpoints.test_task_instance_endpoint.TestPostClearTaskInstances testMethod=test_should_response_200_with_reset_dag_run>
   session = <sqlalchemy.orm.session.Session object at 0x7fdfc5b00790>
   
       @provide_session
       def test_should_response_200_with_reset_dag_run(self, session):
           dag_id = "example_python_operator"
           payload = {
               "dry_run": False,
               "reset_dag_runs": True,
               "only_failed": False,
               "only_running": True,
               "include_subdags": True,
           }
           task_instances = [
               {"execution_date": DEFAULT_DATETIME_1, "state": State.RUNNING},
               {
                   "execution_date": DEFAULT_DATETIME_1 + dt.timedelta(days=1),
                   "state": State.RUNNING,
               },
               {
                   "execution_date": DEFAULT_DATETIME_1 + dt.timedelta(days=2),
                   "state": State.RUNNING,
               },
               {
                   "execution_date": DEFAULT_DATETIME_1 + dt.timedelta(days=3),
                   "state": State.RUNNING,
               },
               {
                   "execution_date": DEFAULT_DATETIME_1 + dt.timedelta(days=4),
                   "state": State.RUNNING,
               },
           ]
       
           self.create_task_instances(
               session,
               dag_id=dag_id,
               single_dag_run=False,
               task_instances=task_instances,
               update_extras=False,
               dag_run_state=State.FAILED,
           )
           response = self.client.post(
               f"/api/v1/dags/{dag_id}/clearTaskInstances",
               environ_overrides={"REMOTE_USER": "test"},
               json=payload,
           )
       
           failed_dag_runs = (
               session.query(DagRun).filter(DagRun.state == "failed").count()  # pylint: disable=W0143
           )
           self.assertEqual(200, response.status_code)
           expected_response = [
               {
                   'dag_id': 'example_python_operator',
                   'dag_run_id': 'TEST_DAG_RUN_ID_0',
                   'execution_date': '2020-01-01T00:00:00+00:00',
                   'task_id': 'print_the_context',
               },
               {
                   'dag_id': 'example_python_operator',
                   'dag_run_id': 'TEST_DAG_RUN_ID_1',
                   'execution_date': '2020-01-02T00:00:00+00:00',
                   'task_id': 'sleep_for_0',
               },
               {
                   'dag_id': 'example_python_operator',
                   'dag_run_id': 'TEST_DAG_RUN_ID_2',
                   'execution_date': '2020-01-03T00:00:00+00:00',
                   'task_id': 'sleep_for_1',
               },
               {
                   'dag_id': 'example_python_operator',
                   'dag_run_id': 'TEST_DAG_RUN_ID_3',
                   'execution_date': '2020-01-04T00:00:00+00:00',
                   'task_id': 'sleep_for_2',
               },
               {
                   'dag_id': 'example_python_operator',
                   'dag_run_id': 'TEST_DAG_RUN_ID_4',
                   'execution_date': '2020-01-05T00:00:00+00:00',
                   'task_id': 'sleep_for_3',
               },
           ]
   >       self.assertEqual(expected_response, response.json["task_instances"])
   E       AssertionError: Lists differ: [{'da[60 chars]N_ID_0', 'execution_date': '2020-01-01T00:00:0[625 chars]_3'}] != [{'da[60 chars]N_ID_4', 'execution_date': '2020-01-05T00:00:0[625 chars]xt'}]
   E       
   E       First differing element 0:
   E       {'dag[59 chars]N_ID_0', 'execution_date': '2020-01-01T00:00:0[36 chars]ext'}
   E       {'dag[59 chars]N_ID_4', 'execution_date': '2020-01-05T00:00:0[30 chars]r_3'}
   E       
   E       Diff is 1680 characters long. Set self.maxDiff to None to see it.
   
   tests/api_connexion/endpoints/test_task_instance_endpoint.py:839: AssertionError
   ```
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [airflow] potiuk closed issue #11816: [QUARANTINE] Flaky test TestPostClearTaskInstances.test_should_response_200_with_reset_dag_run

Posted by GitBox <gi...@apache.org>.
potiuk closed issue #11816:
URL: https://github.com/apache/airflow/issues/11816


   


----------------------------------------------------------------
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:
users@infra.apache.org