| 866 | @pytest.mark.slow |
| 867 | @skip_free_threaded("timing not accurate under the free-threaded build") |
| 868 | def test_stats_connect(proxy, monkeypatch): |
| 869 | proxy.start() |
| 870 | delay_connection(monkeypatch, 0.2) |
| 871 | with pool.ConnectionPool(proxy.client_dsn, min_size=3) as p: |
| 872 | p.wait() |
| 873 | stats = p.get_stats() |
| 874 | assert stats["connections_num"] == 3 |
| 875 | assert stats.get("connections_errors", 0) == 0 |
| 876 | assert stats.get("connections_lost", 0) == 0 |
| 877 | assert 580 <= stats["connections_ms"] < 1200 |
| 878 | |
| 879 | proxy.stop() |
| 880 | p.check() |
| 881 | sleep(0.1) |
| 882 | stats = p.get_stats() |
| 883 | assert stats["connections_num"] > 3 |
| 884 | assert stats["connections_errors"] > 0 |
| 885 | assert stats["connections_lost"] == 3 |
| 886 | |
| 887 | |
| 888 | @pytest.mark.crdb_skip("pg_terminate_backend") |