Skip to content

Feat/add extensions tests#10

Merged
ruxwez merged 6 commits intomainfrom
feat/add_extensions_tests
Oct 24, 2025
Merged

Feat/add extensions tests#10
ruxwez merged 6 commits intomainfrom
feat/add_extensions_tests

Conversation

@ruxwez
Copy link
Owner

@ruxwez ruxwez commented Oct 24, 2025

This pull request introduces a comprehensive test mode for the Docker-based PostgreSQL extensions installer, enabling automated extension installation and validation in CI. It also improves error handling, adds extension tests, and enhances documentation and build workflows.

Testing and CI improvements:

  • Refactored the GitHub Actions workflow (.github/workflows/pr-test.yml) to build images in test mode, run automated extension tests inside containers, and summarize test results. The workflow now excludes the latest tag from the matrix, uses a new TEST_MODE build argument, and loads images for testing. [1] [2]
  • Updated the makefile to add a test target that builds a test image with TEST_MODE=true and runs extension tests in a container.
  • Modified the Dockerfile to support a TEST_MODE build argument, running tests if enabled and only removing the installer binary in production images. [1] [2]

Extension testing and error handling:

  • Added a run_tests function in src/extensions/mod.rs and individual run_test functions for each extension (PostGIS, pgvector, pgmq) to validate their installation using SQL queries. [1] [2] [3] [4]
  • Introduced reusable macros for consistent error, message, and success output, and replaced panics with these macros for better error reporting. [1] [2] [3] [4] [5]
  • Improved PostgreSQL version detection and parsing with new helper functions in src/common.rs.

Dependency and documentation updates:

  • Added clap and sqlx dependencies to support CLI argument parsing and database testing.
  • Enhanced README badges and links for both English and Spanish documentation. [1] [2]

Docker image publishing:

  • Removed the latest tag from the Docker image publishing workflow to avoid ambiguity and ensure explicit versioning. (.github/workflows/docker-build.yml)

Installer core improvements:

  • Added an asynchronous installer function in src/core.rs to orchestrate extension installation and cleanup, using improved error handling and version parsing.

These changes collectively improve the reliability, maintainability, and testability of the PostgreSQL extensions Docker image pipeline.

… version detection

- Updated GitHub Actions workflow to include testing step.
- Added support for detecting PostgreSQL version from the base image.
- Introduced CLI arguments for test mode and PostgreSQL version.
- Enhanced Dockerfile to conditionally run tests based on TEST_MODE.
- Updated README files with new status badges and improved instructions.
- Added configuration management for tests.
- Updated Cargo.toml to include sqlx for PostgreSQL support.
- Modified makefile to build and run tests in a Docker container with PostgreSQL.
- Refactored common.rs to clean up whitespace.
- Enhanced extensions module to include a run_tests function for testing extensions.
- Implemented run_test functions for pgmq, pgvector, and postgis extensions to verify their installation.
- Updated main.rs to initialize the database pool and run extension tests in test mode.
- Removed obsolete config and tests modules, replacing them with a new test module for database pool management.
@ruxwez ruxwez merged commit b47b8bf into main Oct 24, 2025
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant