## Problem We currently don't run end-to-end tests for PostgreSQL extensions on our cloud infrastructure, which means we might miss problems that only occur in a real cloud environment. ## Summary of changes - Added a workflow to run extension tests against a cloud staging instance - Set up proper project configuration for extension testing - Implemented test execution with appropriate environment settings - Added error handling and reporting for test failures --------- Co-authored-by: Alexander Bayandin <alexander@neon.tech> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
PostgreSQL Extensions for Testing
This directory contains PostgreSQL extensions used primarily for:
- Testing extension upgrades between different Compute versions
- Running regression tests with regular users (mostly for cloud instances)
Directory Structure
Each extension directory follows a standard structure:
extension-name-src/- Directory containing test files for the extensiontest-upgrade.sh- Script for testing upgrade scenariosregular-test.sh- Script for testing with regular users- Additional test files depending on the extension
Available Extensions
This directory includes the following extensions:
hll-src- HyperLogLog, a fixed-size data structure for approximating cardinalityhypopg-src- Extension to create hypothetical indexesip4r-src- IPv4/v6 and subnet data typespg_cron-src- Run periodic jobs in PostgreSQLpg_graphql-src- GraphQL support for PostgreSQLpg_hint_plan-src- Execution plan hintspg_ivm-src- Incremental view maintenancepg_jsonschema-src- JSON Schema validationpg_repack-src- Reorganize tables with minimal lockspg_roaringbitmap-src- Roaring bitmap implementationpg_semver-src- Semantic version data typepg_session_jwt-src- JWT authentication for PostgreSQLpg_tiktoken-src- OpenAI Tiktoken tokenizerpg_uuidv7-src- UUIDv7 implementation for PostgreSQLpgjwt-src- JWT tokens for PostgreSQLpgrag-src- Retrieval Augmented Generation for PostgreSQLpgtap-src- Unit testing framework for PostgreSQLpgvector-src- Vector similarity searchpgx_ulid-src- ULID data typeplv8-src- JavaScript language for PostgreSQL stored procedurespostgresql-unit-src- SI units for PostgreSQLprefix-src- Prefix matching for stringsrag_bge_small_en_v15-src- BGE embedding model for RAGrag_jina_reranker_v1_tiny_en-src- Jina reranker model for RAGrum-src- RUM access method for text search
Usage
Extension Upgrade Testing
The extensions in this directory are used by the test-upgrade.sh script to test upgrading extensions between different versions of Neon Compute nodes. The script:
- Creates a database with extensions installed on an old Compute version
- Creates timelines for each extension
- Switches to a new Compute version and tests the upgrade process
- Verifies extension functionality after upgrade
Regular User Testing
For testing with regular users (particularly for cloud instances), each extension directory typically contains a regular-test.sh script that:
- Drops the database if it exists
- Creates a fresh test database
- Installs the extension
- Runs regression tests
A note about pg_regress: Since pg_regress attempts to set lc_messages for the database by default, which is forbidden for regular users, we create databases manually and use the --use-existing option to bypass this limitation.
CI Workflows
Two main workflows use these extensions:
- Cloud Extensions Test - Tests extensions on Neon cloud projects
- Force Test Upgrading of Extension - Tests upgrading extensions between different Compute versions
These workflows are integrated into the build-and-test pipeline through shell scripts:
-
docker_compose_test.sh- Tests extensions in a Docker Compose environment -
test_extensions_upgrade.sh- Tests extension upgrades between different Compute versions
Adding New Extensions
To add a new extension for testing:
- Create a directory named
extension-name-srcin this directory - Add at minimum:
regular-test.shfor testing with regular users- If
regular-test.shdoesn't exist, the system will look forneon-test.sh - If neither exists, it will try to run
make installcheck test-upgrade.shis only needed if you want to test upgrade scenarios
- Update the list of extensions in the
test_extensions_upgrade.shscript if needed for upgrade testing
Patching Extension Sources
If you need to patch the extension sources:
- Place the patch file in the extension's directory
- Apply the patch in the appropriate script (
test-upgrade.sh,neon-test.sh,regular-test.sh, orMakefile) - The patch will be applied during the testing process