File size: 1,223 Bytes
a8b3f00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from core.rag.datasource.vdb.analyticdb.analyticdb_vector import AnalyticdbConfig, AnalyticdbVector
from tests.integration_tests.vdb.test_vector_store import AbstractVectorTest, setup_mock_redis


class AnalyticdbVectorTest(AbstractVectorTest):
    def __init__(self):
        super().__init__()
        # Analyticdb requires collection_name length less than 60.
        # it's ok for normal usage.
        self.collection_name = self.collection_name.replace("_test", "")
        self.vector = AnalyticdbVector(
            collection_name=self.collection_name,
            config=AnalyticdbConfig(
                access_key_id="test_key_id",
                access_key_secret="test_key_secret",
                region_id="test_region",
                instance_id="test_id",
                account="test_account",
                account_password="test_passwd",
                namespace="difytest_namespace",
                collection="difytest_collection",
                namespace_password="test_passwd",
            ),
        )

    def run_all_tests(self):
        self.vector.delete()
        return super().run_all_tests()


def test_chroma_vector(setup_mock_redis):
    AnalyticdbVectorTest().run_all_tests()