mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-11-26 02:13:42 +00:00
fix: careful handling of file permissions during initialization
It has been found that during cold start (e.g. in docker container),
some permissions are invalid. In order to handle that, some operations
are not guarded with RepositoryPaths.preserve_root guard
In addition, it has been also found that in some cases (e.g. web server
start) migrations are performed on empty repository identifier which may
lead to wrong data (see also 435375721d),
as well as some unexpected results during database operations. In order
to handle that, now all watcher instances have their own databases (and
configurations)
This commit is contained in:
@ -36,6 +36,17 @@ def test_init_skip_migration(database: SQLite, mocker: MockerFixture) -> None:
|
||||
migrate_schema_mock.assert_not_called()
|
||||
|
||||
|
||||
def test_init_skip_empty_repository(database: SQLite, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must skip migrations if repository identifier is not set
|
||||
"""
|
||||
database._repository_id = RepositoryId("", "")
|
||||
migrate_schema_mock = mocker.patch("ahriman.core.database.migrations.Migrations.migrate")
|
||||
|
||||
database.init()
|
||||
migrate_schema_mock.assert_not_called()
|
||||
|
||||
|
||||
def test_package_clear(database: SQLite, repository_id: RepositoryId, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must clear package data
|
||||
|
||||
Reference in New Issue
Block a user