|
68 | 68 | ])
|
69 | 69 | registry.register_coder(MetadataConflictRow, RowCoder)
|
70 | 70 |
|
| 71 | +_LOGGER = logging.getLogger(__name__) |
71 | 72 | VECTOR_SIZE = 768
|
72 | 73 |
|
73 | 74 |
|
@@ -141,17 +142,18 @@ def key_on_id(chunk):
|
141 | 142 | return (int(chunk.id.split('_')[1]), chunk)
|
142 | 143 |
|
143 | 144 |
|
| 145 | +@unittest.skipUnless( |
| 146 | + os.environ.get('ALLOYDB_PORT'), |
| 147 | + "ALLOYDB_PORT environment var is not provided") |
144 | 148 | class AlloyDBVectorWriterConfigTest(unittest.TestCase):
|
145 | 149 | ALLOYDB_TABLE_PREFIX = 'python_rag_alloydb_'
|
146 | 150 |
|
147 | 151 | @classmethod
|
148 | 152 | def setUpClass(cls):
|
149 |
| - cls.host = os.environ.get('ALLOYDB_HOST', '10.0.0.2') |
| 153 | + cls.host = os.environ.get('ALLOYDB_HOST', '10.119.0.22') |
150 | 154 | cls.port = os.environ.get('ALLOYDB_PORT', '5432')
|
151 | 155 | cls.database = os.environ.get('ALLOYDB_DATABASE', 'postgres')
|
152 | 156 | cls.username = os.environ.get('ALLOYDB_USERNAME', 'postgres')
|
153 |
| - if not os.environ.get('ALLOYDB_PASSWORD'): |
154 |
| - raise ValueError("ALLOYDB_PASSWORD is not set.") |
155 | 157 | cls.password = os.environ.get('ALLOYDB_PASSWORD')
|
156 | 158 |
|
157 | 159 | # Create unique table name suffix
|
@@ -373,7 +375,7 @@ def custom_row_to_chunk(row):
|
373 | 375 | # Extract timestamp from custom_id
|
374 | 376 | timestamp = row.custom_id.split('timestamp_')[1]
|
375 | 377 | # Extract index from timestamp
|
376 |
| - i = int(timestamp.split('T wrong')[1][:2]) |
| 378 | + i = int(timestamp.split('T')[1][:2]) |
377 | 379 |
|
378 | 380 | # Parse embedding vector
|
379 | 381 | embedding_list = [
|
@@ -488,7 +490,7 @@ def custom_row_to_chunk(row):
|
488 | 490 |
|
489 | 491 | # Verify count
|
490 | 492 | count_result = rows | "Count All" >> beam.combiners.Count.Globally()
|
491 |
| - assert_that(count_result, equal_to([num_records]), label='count_check') |
| 493 | + assert_that(count_result, equal_to([10]), label='count_check') |
492 | 494 |
|
493 | 495 | chunks = rows | "To Chunks" >> beam.Map(custom_row_to_chunk)
|
494 | 496 | assert_that(chunks, equal_to(test_chunks), label='chunks_check')
|
|
0 commit comments