Skip to content

Commit

Permalink
Fix DB isolation tests on v2-10-test (#45021)
Browse files Browse the repository at this point in the history
I failed in backporting to v2-10-test, but in both PRs some else "falls apart".

This PR fixes DB Isolation test reported as "failed" from a test CI run in https://github.com/apache/airflow/actions/runs/12388030828/job/34578488895

From my point of view the tests are OK in general but just test are broken in DB isolation mode. Seems not really being a harm in 2.10.4.
  • Loading branch information
jscheffl authored Dec 18, 2024
1 parent ec4db3e commit 9f87313
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/models/test_mappedoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,7 @@ def group(n: int) -> None:
assert states == expected


@pytest.mark.skip_if_database_isolation_mode # Does not work in db isolation mode
def test_mapped_tasks_in_mapped_task_group_waits_for_upstreams_to_complete(dag_maker, session):
"""Test that one failed trigger rule works well in mapped task group"""
with dag_maker() as dag:
Expand Down Expand Up @@ -1817,6 +1818,7 @@ def t3(a):
assert not ti3.state


@pytest.mark.skip_if_database_isolation_mode # Does not work in db isolation mode
def test_mapped_tasks_in_mapped_task_group_waits_for_upstreams_to_complete__mapped_skip_with_all_success(
dag_maker, session
):
Expand Down
2 changes: 2 additions & 0 deletions tests/models/test_skipmixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def test_skip_none_tasks(self):
assert not session.query.called
assert not session.commit.called

@pytest.mark.skip_if_database_isolation_mode # Does not work in db isolation mode
def test_skip_mapped_task(self, mock_session):
SkipMixin()._skip(
dag_run=MagicMock(spec=DagRun),
Expand All @@ -128,6 +129,7 @@ def test_skip_mapped_task(self, mock_session):
mock_session.execute.assert_not_called()
mock_session.commit.assert_not_called()

@pytest.mark.skip_if_database_isolation_mode # Does not work in db isolation mode
@patch("airflow.models.skipmixin.update")
def test_skip_none_mapped_task(self, mock_update, mock_session):
SkipMixin()._skip(
Expand Down
1 change: 1 addition & 0 deletions tests/models/test_taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3768,6 +3768,7 @@ def test_echo_env_variables(self, dag_maker):
ti.refresh_from_db()
assert ti.state == State.SUCCESS

@pytest.mark.skip_if_database_isolation_mode # Does not work in db isolation mode, fails in context serialization
@pytest.mark.parametrize(
"code, expected_state",
[
Expand Down

0 comments on commit 9f87313

Please sign in to comment.