Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

test_opengauss.py 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import time
  2. import psycopg2 # type: ignore
  3. from core.rag.datasource.vdb.opengauss.opengauss import OpenGauss, OpenGaussConfig
  4. from tests.integration_tests.vdb.test_vector_store import (
  5. AbstractVectorTest,
  6. get_example_text,
  7. setup_mock_redis,
  8. )
  9. class OpenGaussTest(AbstractVectorTest):
  10. def __init__(self):
  11. super().__init__()
  12. max_retries = 5
  13. retry_delay = 20
  14. retry_count = 0
  15. while retry_count < max_retries:
  16. try:
  17. config = OpenGaussConfig(
  18. host="localhost",
  19. port=6600,
  20. user="postgres",
  21. password="Dify@123",
  22. database="dify",
  23. min_connection=1,
  24. max_connection=5,
  25. )
  26. break
  27. except psycopg2.OperationalError as e:
  28. retry_count += 1
  29. if retry_count < max_retries:
  30. time.sleep(retry_delay)
  31. self.vector = OpenGauss(
  32. collection_name=self.collection_name,
  33. config=config,
  34. )
  35. def test_opengauss(setup_mock_redis):
  36. OpenGaussTest().run_all_tests()