mohamedawnallah commented on code in PR #35473: URL: https://github.com/apache/beam/pull/35473#discussion_r2308217181
########## sdks/python/apache_beam/examples/snippets/transforms/elementwise/enrichment_test.py: ########## @@ -60,52 +82,227 @@ def validate_enrichment_with_vertex_ai_legacy(): return expected -def std_out_to_dict(stdout_lines, row_key): - output_dict = {} - for stdout_line in stdout_lines: - # parse the stdout in a dictionary format so that it can be - # evaluated/compared as one. This allows us to compare without - # considering the order of the stdout or the order that the fields of the - # row are arranged in. - fmtd = '{\"' + stdout_line[4:-1].replace('=', '\": ').replace( - ', ', ', \"').replace('\"\'', '\'') + "}" - stdout_dict = eval(fmtd) # pylint: disable=eval-used - output_dict[stdout_dict[row_key]] = stdout_dict - return output_dict +def validate_enrichment_with_google_cloudsql_pg(): + expected = '''[START enrichment_with_google_cloudsql_pg] +Row(product_id=1, name='A', quantity=2, region_id=3) +Row(product_id=2, name='B', quantity=3, region_id=1) +Row(product_id=3, name='C', quantity=10, region_id=4) + [END enrichment_with_google_cloudsql_pg]'''.splitlines()[1:-1] + return expected + + +def validate_enrichment_with_external_pg(): + expected = '''[START enrichment_with_external_pg] +Row(product_id=1, name='A', quantity=2, region_id=3) +Row(product_id=2, name='B', quantity=3, region_id=1) +Row(product_id=3, name='C', quantity=10, region_id=4) + [END enrichment_with_external_pg]'''.splitlines()[1:-1] + return expected + + +def validate_enrichment_with_external_mysql(): + expected = '''[START enrichment_with_external_mysql] +Row(product_id=1, name='A', quantity=2, region_id=3) +Row(product_id=2, name='B', quantity=3, region_id=1) +Row(product_id=3, name='C', quantity=10, region_id=4) + [END enrichment_with_external_mysql]'''.splitlines()[1:-1] + return expected + + +def validate_enrichment_with_external_sqlserver(): + expected = '''[START enrichment_with_external_sqlserver] +Row(product_id=1, name='A', quantity=2, region_id=3) +Row(product_id=2, name='B', quantity=3, region_id=1) +Row(product_id=3, name='C', quantity=10, region_id=4) + [END enrichment_with_external_sqlserver]'''.splitlines()[1:-1] + return expected @mock.patch('sys.stdout', new_callable=StringIO) +@pytest.mark.uses_testcontainer Review Comment: It is nice that those Milvus testcontainers runs on that workflow environment without requiring `docker_in_docker`. Not sure exactly what is the variable parameter (other than different workflow) that makes them really pass here given they are underlying util for creating/stopping docker container! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org