mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-08 14:02:55 +00:00
Use pytest to manage background services, paths, and environment variables. Benefits: - Tests are a little easier to write. - Cleanup is more reliable. You can CTRL-C a test and it will still shut down gracefully. If you manually start a conflicting process, the test fixtures will detect this and abort at startup. - Don't need to worry about remembering '--test-threads=1' - Output of sub-processes can be captured to files. - Test fixtures configure everything to operate under a single test output directory, making it easier to capture logs in CI. - Detects all the necessary paths if run from the git root, but can also run from arbitrary paths by setting environment variables. There is also a deliberately broken test (test_broken.py) that can be used to test whether the test fixtures properly clean up after themselves. It won't run by default; the comment at the top explains how to enable it.
11 lines
312 B
Python
11 lines
312 B
Python
import pytest
|
|
|
|
pytest_plugins = ("fixtures.zenith_fixtures")
|
|
|
|
|
|
def test_pgbench(zen_simple):
|
|
zen_simple.pg_bin.run_capture(
|
|
'pgbench -h localhost -p 55432 -i postgres'.split())
|
|
zen_simple.pg_bin.run_capture(
|
|
'pgbench -h localhost -p 55432 -c 10 -T 100 -P 1 -M prepared postgres'.split())
|