feat(testing): add full integration test suite
Some checks failed
Integration Tests / integration-test (push) Failing after -23m59s

This commit introduces a comprehensive integration test suite for the pgsql-broker.

The test suite includes:
- A Docker/Podman environment for running a PostgreSQL database, managed via a .
- Integration tests that cover the broker's lifecycle, including job creation, execution, and instance management.
- A GitHub Actions workflow to automate the execution of all tests on push and pull requests.
- A dedicated test configuration file () and helper test files.

refactor(worker): fix job processing transaction
- The worker's job processing now uses a single transaction to fetch and run a job, resolving a race condition where jobs were not in the 'running' state when being executed.
- The broker's database instance registration is now more robust, handling cases where another instance is already active.

The Makefile has been significantly updated to orchestrate the entire test flow, including setting up the database, starting/stopping the broker, and running unit and integration tests separately.
This commit is contained in:
2026-01-02 23:08:17 +02:00
parent 19e469ff54
commit 3e64f7ae2a
16 changed files with 406 additions and 34 deletions

25
broker.test.yaml Normal file
View File

@@ -0,0 +1,25 @@
databases:
- name: test
host: localhost
port: 5433
database: broker_test
user: user
password: password
sslmode: disable
max_open_conns: 10
max_idle_conns: 5
conn_max_lifetime: 5m
queue_count: 1
broker:
name: pgsql-broker-test
fetch_query_que_size: 10
queue_timer_sec: 2
queue_buffer_size: 10
worker_idle_timeout_sec: 5
notify_retry_seconds: 10s
enable_debug: true
logging:
level: debug
format: json