uranusjr commented on a change in pull request #18161:
URL: https://github.com/apache/airflow/pull/18161#discussion_r724638456
##########
File path: tests/www/views/test_views_connection.py
##########
@@ -148,3 +148,43 @@ def test_duplicate_connection(admin_client):
response = {conn[0] for conn in session.query(Connection.conn_id).all()}
assert resp.status_code == 200
assert expected_result == response
+
+
+def test_duplicate_connection_error(admin_client):
+ """Test Duplicate multiple connection with suffix
+ when there are already 10 copies, no new copy
+ should be created"""
+
+ connections = []
+ connection_ids = []
+
+ for i in range(1, 11):
+ connection_id = f'test_duplicate_postgres_connection_copy{i}'
+ print(f"connection_id {connection_id}")
+ conn1 = Connection(
+ conn_id=connection_id,
+ conn_type='FTP',
+ description='Postgres',
+ host='localhost',
+ schema='airflow',
+ port=3306,
+ )
+ connections.append(conn1)
+ connection_ids.append(conn1.id)
Review comment:
```suggestion
connection_ids = [f'test_duplicate_postgres_connection_copy{i}' for i in
range(1, 11)]
connections = [
Connection(
conn_id=connection_id,
conn_type='FTP',
description='Postgres',
host='localhost',
schema='airflow',
port=3306,
)
for connection_id in connection_ids
]
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]