Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a99e035
pgaftest-infra: new test DSL, binary split, inspect/override commands
dimitri Jun 28, 2026
cabeb1e
build: fix make -C src/bin on macOS
dimitri Jun 28, 2026
3d42128
common: move generic utility sources to src/bin/common/
dimitri Jun 28, 2026
b0d52e0
build: fix default-goal bug and two dangling-pointer warnings
dimitri Jun 28, 2026
aee4944
pgaftest: fix compose, cli, and test spec
dimitri Jun 28, 2026
fac227f
pgaftest: increase fail_primary timeout to 120s for reliability
dimitri Jun 28, 2026
22ab675
pg_autoctl: replace 'do'/'override' with 'manual'; hide internal entr…
dimitri Jun 28, 2026
bfd0dc4
pg_autoctl inspect/manual: fix read/write split, remove duplicate getpid
dimitri Jun 28, 2026
21560e4
pg_autoctl: rename 'do' to 'internal'; trim to subprocess entry point…
dimitri Jun 28, 2026
fe341da
pg_autoctl node: declarative node spec file + supervisor file watcher
dimitri Jun 28, 2026
c896747
docs: pg_autoctl node spec file, node commands, pgaftest spec DSL
dimitri Jun 28, 2026
b11a85d
pgaftest: cluster { formation { nodes } } hierarchy, [create]→[option…
dimitri Jun 28, 2026
8cff388
pgaftest: update all .pgaf specs to formation{} syntax; extend node D…
dimitri Jun 28, 2026
1c4a5cb
pgaftest: convert all multi-line expect blocks to inline tuple form
dimitri Jun 28, 2026
03803ae
pgaftest: add expect error and exec-fails commands for negative testing
dimitri Jun 28, 2026
9dc917b
pgaftest: port all @raises(Exception) steps from Python tests
dimitri Jun 28, 2026
df01537
pgaftest: add no-autostart node attribute; port create_standby_with_p…
dimitri Jun 28, 2026
678c43e
pgaftest: add GitHub Actions workflow and upgrade test fixes
dimitri Jul 4, 2026
639913a
gitignore: exclude pgaftest build artifacts (.tmp, bison .tab.c)
dimitri Jul 4, 2026
d4acb65
ci: generate git-version.h before docker build in pgaftest workflow
dimitri Jul 4, 2026
812103f
ci: fix pgaftest binary path collision with work directory (/tmp/pgaf…
dimitri Jul 4, 2026
af0b5b6
Fix CI failures: chmod ini files, PG17 for regular tests, extension_u…
dimitri Jul 4, 2026
9909b2e
Fix ssl_cert key permissions, replace_monitor --force, installcheck i…
dimitri Jul 4, 2026
dc3bf7e
replace_monitor: compose start + set monitor for new monitor
dimitri Jul 4, 2026
058e23c
upgrade: increase failover timeout to 240s post-upgrade
dimitri Jul 4, 2026
2072404
replace_monitor: fix enable monitor command syntax
dimitri Jul 4, 2026
643818f
Fix replace_monitor and skip_pg_hba specs
dimitri Jul 4, 2026
6f45664
Fix remaining CI failures: auth passwords, no-monitor healthcheck, st…
dimitri Jul 4, 2026
b177233
Fix CI: ssl off for multi-* tests, fix skip_pg_hba and auth commands
dimitri Jul 4, 2026
8c28d16
Fix CI: timeout increases, enable monitor user, enable ssl restart, s…
dimitri Jul 4, 2026
9a17461
tests: fix skip_pg_hba, monitor_disabled, enable_ssl
dimitri Jul 4, 2026
d14cf9a
linting: fix banned API usage and exclude pgaftest from citus-style
dimitri Jul 4, 2026
81198f4
linting: fix all banned API violations and citus_indent formatting
dimitri Jul 4, 2026
0a18023
tests: fix multi_ifdown ssl off and multi_alternate node3 wait
dimitri Jul 4, 2026
0e7f068
style: use Docker citus/stylechecker:no-py for authoritative formatting
dimitri Jul 4, 2026
0823a01
style: fix Makefile to use citus_indent from PATH in CI, Docker locally
dimitri Jul 4, 2026
2a8efff
ci: use citus/stylechecker:no-py container for style check; update do…
dimitri Jul 4, 2026
d028012
pgaftest: fix wait until assigned-state, no-monitor compose, hba-lan …
dimitri Jul 4, 2026
504c6b7
fix hba-lan: defer pgSetup init to after config file exists
dimitri Jul 4, 2026
ab861f3
style: run citus_indent over all changed C files
dimitri Jul 4, 2026
a173911
fix: upgrade build and multi_async race condition
dimitri Jul 6, 2026
8f2ffb8
style: run citus_indent in CI docker container (no-py)
dimitri Jul 6, 2026
7c093af
fix: SIGHUP race in reload, multi_async report_lsn timing, drop-prima…
dimitri Jul 6, 2026
afe91c3
fix: drop node succeeds when service already cleaned up state file
dimitri Jul 6, 2026
2185732
fix: use explicit touch for bison-generated files in Dockerfile
dimitri Jul 6, 2026
518d38f
fix: guard pgaftest touch step against pre-pgaftest git archives
dimitri Jul 6, 2026
5aba400
fix: poll monitor directly when LISTEN notifications are missed in wa…
dimitri Jul 6, 2026
c3ae322
pgaftest: trust notify convergence without subprocess double-check
dimitri Jul 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ src/bin/lib/libs/** -citus-style
src/bin/lib/pg/** -citus-style
src/bin/lib/subcommands.c/** -citus-style
src/monitor/version_compat.c -citus-style
src/bin/pgaftest/** -citus-style
259 changes: 259 additions & 0 deletions .github/workflows/run-pgaftest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
name: pgaftest

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

# One run per branch; cancel in-progress runs on new push.
concurrency:
group: pgaftest-${{ github.ref }}
cancel-in-progress: true

jobs:
# ---------------------------------------------------------------------------
# Build the runtime Docker image and the pgaftest binary once, then share
# both as artifacts with every parallel test job.
# ---------------------------------------------------------------------------
build:
name: Build image & pgaftest
runs-on: ubuntu-latest
env:
PGVERSION: 17

steps:
- uses: actions/checkout@v4.2.2

# git-version.h is generated from the working tree and must exist on the
# host before the Docker build COPY step reads it.
- name: Generate git-version.h
run: make version

- name: Build pg_auto_failover run image
run: |
docker build \
--build-arg PGVERSION=${{ env.PGVERSION }} \
--target run \
-t pgaf:run \
.

- name: Save pgaf:run image as a tarball
run: docker save pgaf:run | gzip > /tmp/pgaf-run.tar.gz

- name: Upload pgaf:run image artifact
uses: actions/upload-artifact@v4.4.3
with:
name: pgaf-run-image
path: /tmp/pgaf-run.tar.gz
# Only needed for the duration of this workflow run.
retention-days: 1

# Build the full build image just to extract the pgaftest binary.
# The binary is linux/amd64, linked against PGDG libpq — matches
# ubuntu-latest runners where the test jobs will execute it.
- name: Build pg_auto_failover build image (for pgaftest extraction)
run: |
docker build \
--build-arg PGVERSION=${{ env.PGVERSION }} \
--target build \
-t pgaf:build \
.

- name: Extract pgaftest binary from build image
run: |
docker create --name pgaftest-extract pgaf:build
docker cp pgaftest-extract:/usr/lib/postgresql/${{ env.PGVERSION }}/bin/pgaftest \
/tmp/pgaftest-bin
docker rm pgaftest-extract
chmod +x /tmp/pgaftest-bin

- name: Upload pgaftest binary artifact
uses: actions/upload-artifact@v4.4.3
with:
name: pgaftest-binary
path: /tmp/pgaftest-bin
retention-days: 1

# ---------------------------------------------------------------------------
# Run all non-upgrade specs from tests/tap/schedule in a matrix.
# Each job is independent; they all share the pre-built image and binary.
# ---------------------------------------------------------------------------
test:
name: pgaftest / ${{ matrix.spec }}
needs: build
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
spec:
- basic_operation
- basic_operation_listen_flag
- maintenance_and_drop
- create_standby_with_pgdata
- ensure
- monitor_disabled
- replace_monitor
- config_get_set
- skip_pg_hba
- auth
- enable_ssl
- ssl_cert
- ssl_self_signed
- multi_standbys
- multi_async
- multi_ifdown
- multi_maintenance
- multi_alternate
- extension_update

steps:
- uses: actions/checkout@v4.2.2

- name: Download pgaf:run image
uses: actions/download-artifact@v4.1.8
with:
name: pgaf-run-image
path: /tmp

- name: Load pgaf:run image into Docker
run: docker load < /tmp/pgaf-run.tar.gz

- name: Download pgaftest binary
uses: actions/download-artifact@v4.1.8
with:
name: pgaftest-binary
path: /tmp

# pgaftest links against PGDG libpq — install the matching runtime lib.
- name: Install libpq runtime
run: |
sudo apt-get install -y curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt \
$(lsb_release -cs)-pgdg main" \
| sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get install -y libpq5

- name: Run ${{ matrix.spec }}
timeout-minutes: 18
env:
PGAF_IMAGE: pgaf:run
run: |
chmod +x /tmp/pgaftest-bin
/tmp/pgaftest-bin run tests/tap/specs/${{ matrix.spec }}.pgaf

# ---------------------------------------------------------------------------
# installcheck: builds pgaf:testrun (run + source tree + postgresql-server-dev)
# and runs the SQL regression test suite via pg_regress. Kept separate from
# the main matrix because it requires a larger image built inline.
# ---------------------------------------------------------------------------
installcheck:
name: pgaftest / installcheck
needs: build
runs-on: ubuntu-latest
timeout-minutes: 20
env:
PGVERSION: 17

steps:
- uses: actions/checkout@v4.2.2

- name: Install libpq runtime
run: |
sudo apt-get install -y curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt \
$(lsb_release -cs)-pgdg main" \
| sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get install -y libpq5

- name: Download pgaftest binary
uses: actions/download-artifact@v4.1.8
with:
name: pgaftest-binary
path: /tmp

- name: Generate git-version.h
run: make version

- name: Build pgaf:testrun image
run: |
docker build \
--build-arg PGVERSION=${{ env.PGVERSION }} \
--target testrun \
-t pgaf:testrun \
.

- name: Run installcheck spec
timeout-minutes: 15
run: |
chmod +x /tmp/pgaftest-bin
/tmp/pgaftest-bin run tests/tap/specs/installcheck.pgaf

# ---------------------------------------------------------------------------
# Upgrade test: builds both pgaf:next (current branch) and pgaf:current
# (the previous release tag, auto-detected), then runs the upgrade spec.
# Kept separate because it needs a PGVERSION=16 image and additional
# build steps (pgaf:current-base from git archive of PREV_TAG).
# ---------------------------------------------------------------------------
upgrade:
name: pgaftest / upgrade
needs: build
runs-on: ubuntu-latest
timeout-minutes: 30
env:
PGVERSION: 16

steps:
- uses: actions/checkout@v4.2.2
with:
# Full history needed so PREV_TAG auto-detection (git tag --sort)
# finds the correct previous release tag.
fetch-depth: 0

- name: Install libpq runtime
run: |
sudo apt-get install -y curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt \
$(lsb_release -cs)-pgdg main" \
| sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get install -y libpq5

- name: Download pgaftest binary
uses: actions/download-artifact@v4.1.8
with:
name: pgaftest-binary
path: /tmp

- name: Generate git-version.h
run: make version

# The build job already produced pgaf:run at PG16 for the regular tests,
# but the upgrade job runs independently and needs its own images.
# Build pgaf:next first so pgaf:current's Dockerfile.current can COPY
# the v2.2 binary and extension files from it.
- name: Build pgaf:next (current branch, PGVERSION=16)
run: |
make -C tests/upgrade pgaf-next PGVERSION=${{ env.PGVERSION }}

- name: Build pgaf:current (previous release + both binaries baked in)
run: |
make -C tests/upgrade pgaf-current PGVERSION=${{ env.PGVERSION }}

- name: Run upgrade spec
timeout-minutes: 25
run: |
chmod +x /tmp/pgaftest-bin
/tmp/pgaftest-bin run tests/tap/specs/upgrade.pgaf
61 changes: 25 additions & 36 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@ name: Run Tests
on:
push:
branches:
- main
- main
pull_request:
branches:
- main

- main
workflow_dispatch:

jobs:
style_checker:
name: Style check
runs-on: ubuntu-latest
container: citus/stylechecker:no-py
steps:
- name: Checkout repository
uses: actions/checkout@v4.2.2

- name: Set safe directory for git
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}

- name: Check C formatting
run: citus_indent --check

- name: Check banned functions
run: ci/banned.h.sh

run_tests:
name: Run test
runs-on: ubuntu-latest
Expand All @@ -33,46 +49,19 @@ jobs:
include:
- PGVERSION: 14
TEST: tablespaces
- PGVERSION: 14
TEST: linting
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4.2.2

- name: Set environment variables
run: |
echo "PGVERSION=${{ matrix.PGVERSION }}" >> $GITHUB_ENV
echo "TEST=${{ matrix.TEST }}" >> $GITHUB_ENV
echo "LINTING=${{ matrix.LINTING }}" >> $GITHUB_ENV
echo "TRAVIS_BUILD_DIR=$(pwd)" >> $GITHUB_ENV

- name: Clone and install linting tools
if: ${{ env.TEST == 'linting' }}
run: |
sudo apt-get install python3-pip
pip3 install --user black
black --version
gcc --version
# Install uncrustify the Citus way
make -C ci -f tools.mk tools

- name: Check code formatting and banned function
if: ${{ env.TEST == 'linting' }}
run: |
make lint

- name: Build documentation
if: ${{ env.TEST == 'linting' }}
run: |
make build-docs
echo "PGVERSION=${{ matrix.PGVERSION }}" >> $GITHUB_ENV
echo "TEST=${{ matrix.TEST }}" >> $GITHUB_ENV
echo "TRAVIS_BUILD_DIR=$(pwd)" >> $GITHUB_ENV

- name: Build Docker Test Image
if: ${{ env.TEST != 'linting' }}
run: |
make build-test-image
run: make build-test-image

- name: Run Test
if: ${{ env.TEST != 'linting' }}
timeout-minutes: 15
run: |
make ci-test
run: make ci-test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ docs/tikz/*.png
# Exclude our demo/test tmux directory
tmux/
valgrind/
*.tmp
src/bin/pgaftest/test_spec_parse.tab.*
src/bin/pgaftest/test_spec_parse.output
Loading
Loading