Add a test

This commit is contained in:
kssenii 2023-12-06 19:34:52 +01:00
parent 29c770502a
commit 6368d060b7

View File

@ -810,6 +810,29 @@ def test_replica_consumer(started_cluster):
pg_manager_instance2.clear()
def test_failed_load_from_snapshot(started_cluster):
table = "failed_load"
pg_manager.create_postgres_table(
table,
template="""
CREATE TABLE IF NOT EXISTS "{}" (
key text NOT NULL, value text[], PRIMARY KEY(key))
""",
)
instance.query(
f"INSERT INTO postgres_database.{table} SELECT number, [1, 2] from numbers(0, 1000000)"
)
# Create a table with wrong table structure
assert "pqxx::conversion_error: Could not convert string to i" in instance.query_and_get_error(
f"""
SET allow_experimental_materialized_postgresql_table=1;
CREATE TABLE {table} (a Int32, b Int32) ENGINE=MaterializedPostgreSQL('{started_cluster.postgres_ip}:{started_cluster.postgres_port}', 'postgres_database', '{table}', 'postgres', 'mysecretpassword') ORDER BY a
"""
)
if __name__ == "__main__":
cluster.start()
input("Cluster created, press any key to destroy...")