Skip to content

Commit

Permalink
refactor: revert the logic and replace close with shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetcanay committed Oct 23, 2024
1 parent 23a46a2 commit f9b5eac
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/test_weaviate_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,16 @@ def test_terminology_and_model_specific_mappings_with_similarities(self):

def test_repository_restart(self):
"""Test the repository restart functionality to ensure no data is lost or corrupted."""
self.repository.close()
self.repository.client.connect()
self.repository.shut_down()
# Re-initialize repository
repository = WeaviateRepository(mode="disk", path="db")

# Try storing the same data again (should not create duplicates)
self.repository.store_all([self.terminology1, self.terminology2] + [item[0] for item in self.concepts_mappings] + [item[1] for item in self.concepts_mappings])
repository.store_all([self.terminology1, self.terminology2] + [item[0] for item in self.concepts_mappings] + [item[1] for item in self.concepts_mappings])

# Check if mappings and concepts are intact
mappings = self.repository.get_mappings(limit=5)
mappings = repository.get_mappings(limit=5)
self.assertEqual(len(mappings), 5)

concepts = self.repository.get_all_concepts()
concepts = repository.get_all_concepts()
self.assertEqual(len(concepts), 9)

0 comments on commit f9b5eac

Please sign in to comment.