PgBouncer

Channel Revision Published Runs on
latest/stable 5 17 Jan 2022
Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
1/stable 397 11 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
1/stable 396 11 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
1/stable 395 11 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
1/stable 394 11 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
1/candidate 397 02 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
1/candidate 396 02 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
1/candidate 395 02 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
1/candidate 394 02 Sep 2024
Ubuntu 22.04 Ubuntu 20.04
1/beta 397 29 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
1/beta 396 29 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
1/beta 395 29 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
1/beta 394 29 Aug 2024
Ubuntu 22.04 Ubuntu 20.04
1/edge 530 Yesterday
Ubuntu 22.04 Ubuntu 20.04
1/edge 529 Yesterday
Ubuntu 22.04 Ubuntu 20.04
1/edge 528 Yesterday
Ubuntu 22.04 Ubuntu 20.04
1/edge 527 Yesterday
Ubuntu 22.04 Ubuntu 20.04
juju deploy pgbouncer --channel 1/edge
Show information

Platform:

Ubuntu
22.04 20.04 18.04 16.04

Charm Testing reference

There are a lot of test types available and most of them are well applicable for PgBouncer. Here is a list prepared by Canonical:

  • Smoke test
  • Unit tests
  • Integration tests
  • System test
  • Performance test

:information_source: Note: below examples are written for Juju 3.x, but Juju 2.9 is supported as well.
Please adopt the juju run ... commands as juju run-action ... --wait for Juju 2.9.

Smoke test

Complexity: trivial
Speed: fast
Goal: ensure basic functionality works over short amount of time.

Setup an Juju 3.x environment, deploy DB with test application and start “continuous write” test:

juju add-model smoke-test

juju deploy postgresql --channel 14/stable --config profile=testing
juju deploy pgbouncer --channel 1/stable
juju relate postgresql pgbouncer

juju add-unit postgresql -n 2 # (optional)

juju deploy postgresql-test-app -n 3 --channel latest/stable
juju relate pgbouncer postgresql-test-app:first-database

# Make sure random data inserted into DB by test application:
juju run postgresql-test-app/leader get-inserted-data

# Start "continuous write" test:
juju run postgresql-test-app/leader start-continuous-writes
export password=$(juju run postgresql/leader get-password username=operator | yq '.. | select(. | has("password")).password')
watch -n1 -x juju ssh postgresql-test-app/leader "charmed-postgresql.psql -h 127.0.0.1 -p 6432 -U operator -W -d postgresql_test_app_first_database \"select count(*) from continuous_writes\""

# Watch the counter is growing!

Expected results:

  • postgresql-test-app continuously inserts records in database postgresql_test_app_first_database table continuous_writes.
  • the counters (amount of records in table) are growing on all cluster members

Hints:

# Stop "continuous write" test
juju run postgresql-test-app/leader stop-continuous-writes

# Truncate "continuous write" table (delete all records from DB)
juju run postgresql-test-app/leader clear-continuous-writes

Unit tests

Please check the “Contributing” guide and follow tox run -e unit examples there.

Integration tests

Please check the “Contributing” guide and follow tox run -e integration examples there.

System test

Please check/deploy the charm postgresql-bundle (Git). It deploy and test all the necessary parts at once.

Performance test

Please use the separate Charmed PostgreSQL performance testing document but deploy Charmed PostgreSQL behind PgBouncer.


Help improve this document in the forum (guidelines). Last updated 1 year, 28 days ago.