|
34 | 34 | DEFAULT_IS_TABLE_SYNC = "index_store_" + str(uuid.uuid4())
|
35 | 35 | DEFAULT_VS_TABLE = "vector_store_" + str(uuid.uuid4())
|
36 | 36 | DEFAULT_VS_TABLE_SYNC = "vector_store_" + str(uuid.uuid4())
|
| 37 | +DEFAULT_CS_TABLE = "chat_store_" + str(uuid.uuid4()) |
| 38 | +DEFAULT_CS_TABLE_SYNC = "chat_store_" + str(uuid.uuid4()) |
37 | 39 | VECTOR_SIZE = 768
|
38 | 40 |
|
39 | 41 |
|
@@ -113,6 +115,7 @@ async def engine(self, db_project, db_region, db_instance, db_name):
|
113 | 115 | await aexecute(engine, f'DROP TABLE "{DEFAULT_DS_TABLE}"')
|
114 | 116 | await aexecute(engine, f'DROP TABLE "{DEFAULT_VS_TABLE}"')
|
115 | 117 | await aexecute(engine, f'DROP TABLE "{DEFAULT_IS_TABLE}"')
|
| 118 | + await aexecute(engine, f'DROP TABLE "{DEFAULT_CS_TABLE}"') |
116 | 119 | await engine.close()
|
117 | 120 |
|
118 | 121 | async def test_password(
|
@@ -296,6 +299,22 @@ async def test_init_index_store(self, engine):
|
296 | 299 | for row in results:
|
297 | 300 | assert row in expected
|
298 | 301 |
|
| 302 | + async def test_init_chat_store(self, engine): |
| 303 | + await engine.ainit_chat_store_table( |
| 304 | + table_name=DEFAULT_CS_TABLE, |
| 305 | + schema_name="public", |
| 306 | + overwrite_existing=True, |
| 307 | + ) |
| 308 | + stmt = f"SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '{DEFAULT_CS_TABLE}';" |
| 309 | + results = await afetch(engine, stmt) |
| 310 | + expected = [ |
| 311 | + {"column_name": "id", "data_type": "integer"}, |
| 312 | + {"column_name": "key", "data_type": "character varying"}, |
| 313 | + {"column_name": "message", "data_type": "json"}, |
| 314 | + ] |
| 315 | + for row in results: |
| 316 | + assert row in expected |
| 317 | + |
299 | 318 |
|
300 | 319 | @pytest.mark.asyncio
|
301 | 320 | class TestEngineSync:
|
@@ -343,6 +362,7 @@ async def engine(self, db_project, db_region, db_instance, db_name):
|
343 | 362 | await aexecute(engine, f'DROP TABLE "{DEFAULT_DS_TABLE_SYNC}"')
|
344 | 363 | await aexecute(engine, f'DROP TABLE "{DEFAULT_IS_TABLE_SYNC}"')
|
345 | 364 | await aexecute(engine, f'DROP TABLE "{DEFAULT_VS_TABLE_SYNC}"')
|
| 365 | + await aexecute(engine, f'DROP TABLE "{DEFAULT_CS_TABLE_SYNC}"') |
346 | 366 | await engine.close()
|
347 | 367 |
|
348 | 368 | async def test_password(
|
@@ -461,3 +481,19 @@ async def test_init_index_store(self, engine):
|
461 | 481 | ]
|
462 | 482 | for row in results:
|
463 | 483 | assert row in expected
|
| 484 | + |
| 485 | + async def test_init_chat_store(self, engine): |
| 486 | + engine.init_chat_store_table( |
| 487 | + table_name=DEFAULT_CS_TABLE_SYNC, |
| 488 | + schema_name="public", |
| 489 | + overwrite_existing=True, |
| 490 | + ) |
| 491 | + stmt = f"SELECT column_name, data_type FROM information_schema.columns WHERE table_name = '{DEFAULT_CS_TABLE_SYNC}';" |
| 492 | + results = await afetch(engine, stmt) |
| 493 | + expected = [ |
| 494 | + {"column_name": "id", "data_type": "integer"}, |
| 495 | + {"column_name": "key", "data_type": "character varying"}, |
| 496 | + {"column_name": "message", "data_type": "json"}, |
| 497 | + ] |
| 498 | + for row in results: |
| 499 | + assert row in expected |
0 commit comments