test_analyticdb.py 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. from core.rag.datasource.vdb.analyticdb.analyticdb_vector import AnalyticdbConfig, AnalyticdbVector
  2. from tests.integration_tests.vdb.test_vector_store import AbstractVectorTest, setup_mock_redis
  3. class AnalyticdbVectorTest(AbstractVectorTest):
  4. def __init__(self):
  5. super().__init__()
  6. # Analyticdb requires collection_name length less than 60.
  7. # it's ok for normal usage.
  8. self.collection_name = self.collection_name.replace("_test", "")
  9. self.vector = AnalyticdbVector(
  10. collection_name=self.collection_name,
  11. config=AnalyticdbConfig(
  12. access_key_id="test_key_id",
  13. access_key_secret="test_key_secret",
  14. region_id="test_region",
  15. instance_id="test_id",
  16. account="test_account",
  17. account_password="test_passwd",
  18. namespace="difytest_namespace",
  19. collection="difytest_collection",
  20. namespace_password="test_passwd",
  21. ),
  22. )
  23. def run_all_tests(self):
  24. self.vector.delete()
  25. return super().run_all_tests()
  26. def test_chroma_vector(setup_mock_redis):
  27. AnalyticdbVectorTest().run_all_tests()