test_runner/random_ops/README.md
Neon needs robust testing of Neon's stability to ensure reliability for users. The random operations test addresses this by continuously exercising the API with unpredictable sequences of operations, helping to identify edge cases and potential issues that might not be caught by deterministic tests.
The test implements three main classes to model the Neon architecture:
The test randomly performs the following operations with weighted probabilities:
Each branch and endpoint is loaded with pgbench to simulate real database workloads during testing. This ensures that the operations are performed against branches with actual data and ongoing transactions.
The test includes robust error handling for various scenarios:
The test is integrated into the CI pipeline via a GitHub workflow that runs daily, ensuring continuous validation of API stability.
The test can be configured with:
RANDOM_SEED: Set a specific random seed for reproducible test runsNEON_API_KEY: API key for authenticationNEON_API_BASE_URL: Base URL for the API (defaults to staging environment)NUM_OPERATIONS: The number of operations to be performedThe test is designed to run in the CI environment but can also be executed locally:
NEON_API_KEY=your_api_key ./scripts/pytest test_runner/random_ops/test_random_ops.py -m remote_cluster
To run with a specific random seed for reproducibility:
RANDOM_SEED=12345 NEON_API_KEY=your_api_key ./scripts/pytest test_runner/random_ops/test_random_ops.py -m remote_cluster
To run with the custom number of operations:
NUM_OPERATIONS=500 NEON_API_KEY=your_api_key ./scripts/pytest test_runner/random_ops/test_random_ops.py -m remote_cluster
This test provides several key benefits:
Potential enhancements to the test could include:
reset_to_parent, snapshot, etc