Skip to content

Commit

Permalink
Run the check_migration loop at least once (#24068)
Browse files Browse the repository at this point in the history
This is broken since 2.3.0. that's if a user specifies a migration_timeout
of 0 then no migration is run at all.
  • Loading branch information
ephraimbuddy authored Jun 1, 2022
1 parent 841ed27 commit 84d7b5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions airflow/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ def check_migrations(timeout):
:param timeout: Timeout for the migration in seconds
:return: None
"""
timeout = timeout or 1 # run the loop at least 1
with _configured_alembic_environment() as env:
context = env.get_context()
source_heads = None
Expand Down
1 change: 1 addition & 0 deletions tests/utils/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def test_default_connections_sort(self):

def test_check_migrations(self):
# Should run without error. Can't easily test the behaviour, but we can check it works
check_migrations(0)
check_migrations(1)

@mock.patch('alembic.command')
Expand Down

0 comments on commit 84d7b5b

Please sign in to comment.