diff --git a/tests/unit/test_backup_tables.py b/tests/unit/test_backup_tables.py index ce1dfd60..4c69f309 100644 --- a/tests/unit/test_backup_tables.py +++ b/tests/unit/test_backup_tables.py @@ -71,4 +71,4 @@ def test_backup_table_skipping_if_metadata_updated_during_backup( assert len(context.backup_meta.get_tables(db_name)) == backups_expected # One call after each table and one after database is backuped - assert clickhouse_ctl_mock.remove_freezed_data.call_count == 2 + assert clickhouse_ctl_mock.remove_freezed_data.call_count == 1 diff --git a/tests/unit/test_upload_part_observer.py b/tests/unit/test_upload_part_observer.py index f5f928a1..d2aa0aa2 100644 --- a/tests/unit/test_upload_part_observer.py +++ b/tests/unit/test_upload_part_observer.py @@ -1,4 +1,3 @@ -import copy from typing import List from unittest.mock import Mock, patch @@ -16,17 +15,20 @@ TABLE_NAME = "test_table" ENGINE = "MergeTree" BACKUP_NAME = "TestBackup" -BACKUP_META = BackupMetadata( - name=BACKUP_NAME, - path=f"ch_backup/{BACKUP_NAME}", - version="1.0.100", - ch_version="19.1.16", - time_format="%Y-%m-%dT%H:%M:%S%Z", - hostname="clickhouse01.test_net_711", -) DB = Database(DB_NAME, ENGINE, f"/var/lib/clickhouse/metadata/{DB_NAME}.sql") +def create_backup_meta() -> BackupMetadata: + return BackupMetadata( + name=BACKUP_NAME, + path=f"ch_backup/{BACKUP_NAME}", + version="1.0.100", + ch_version="19.1.16", + time_format="%Y-%m-%dT%H:%M:%S%Z", + hostname="clickhouse01.test_net_711", + ) + + @parametrize( { "id": "One part before interval", @@ -82,7 +84,7 @@ def test_observer( ) -> None: config = {"backup": {"update_metadata_interval": interval}} - backup_meta = copy.deepcopy(BACKUP_META) + backup_meta = create_backup_meta() backup_meta.add_database(DB) context = BackupContext(config) # type: ignore[arg-type]