Skip to content

Commit 94824a7

Browse files
authored
Merge pull request #1629 from weaviate/fix_backup_tests_concurency
Always specify which classes should be backed up and restored
2 parents b804eee + 5d199b9 commit 94824a7

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

integration/test_backup_v4.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@
7272
"datePublished": datetime.datetime.now(datetime.timezone.utc).isoformat(),
7373
},
7474
]
75+
CLASSES = ["Paragraph", "Article"]
7576

7677

7778
@pytest.fixture(scope="module")
7879
def client() -> Generator[weaviate.WeaviateClient, None, None]:
7980
client = weaviate.connect_to_local()
80-
client.collections.delete("Paragraph")
81-
client.collections.delete("Article")
81+
client.collections.delete(CLASSES)
8282

8383
col_para = client.collections.create(
8484
name="Paragraph",
@@ -123,7 +123,9 @@ def test_create_and_restore_backup_with_waiting(client: weaviate.WeaviateClient)
123123

124124
# create backup
125125
classes = ["Article", "Paragraph"]
126-
resp = client.backup.create(backup_id=backup_id, backend=BACKEND, wait_for_completion=True)
126+
resp = client.backup.create(
127+
backup_id=backup_id, backend=BACKEND, wait_for_completion=True, include_collections=CLASSES
128+
)
127129
assert resp.status == BackupStatus.SUCCESS
128130
for cls in classes:
129131
assert cls in resp.collections
@@ -141,7 +143,9 @@ def test_create_and_restore_backup_with_waiting(client: weaviate.WeaviateClient)
141143
client.collections.delete("Paragraph")
142144

143145
# restore backup
144-
restore = client.backup.restore(backup_id=backup_id, backend=BACKEND, wait_for_completion=True)
146+
restore = client.backup.restore(
147+
backup_id=backup_id, backend=BACKEND, wait_for_completion=True, include_collections=CLASSES
148+
)
145149
assert restore.status == BackupStatus.SUCCESS
146150
for cls in classes:
147151
assert cls in resp.collections
@@ -349,7 +353,7 @@ def test_fail_creating_backup_for_both_include_and_exclude_classes(
349353

350354

351355
@pytest.mark.parametrize("dynamic_backup_location", [False, True])
352-
def test_backup_and_restore_with_collection(
356+
def test_backup_and_restore_with_dynamic_location(
353357
client: weaviate.WeaviateClient, dynamic_backup_location: bool, tmp_path: pathlib.Path
354358
) -> None:
355359
backup_id = _create_backup_id()
@@ -513,7 +517,10 @@ def test_cancel_backup(
513517
backup_location = wvc.backup.BackupLocation.FileSystem(path=str(tmp_path))
514518

515519
resp = client.backup.create(
516-
backup_id=backup_id, backend=BACKEND, backup_location=backup_location
520+
backup_id=backup_id,
521+
backend=BACKEND,
522+
backup_location=backup_location,
523+
include_collections=CLASSES,
517524
)
518525
assert resp.status == BackupStatus.STARTED
519526

0 commit comments

Comments
 (0)