Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. cat ../ansible-role-pgbouncer/molecule/default/tests/test_default.py
  2. import os
  3.  
  4. import testinfra.utils.ansible_runner
  5.  
  6. testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
  7. os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
  8.  
  9.  
  10. def test_postgres_package(host):
  11. pkg = host.package('pgbouncer')
  12. assert pkg.is_installed
  13.  
  14.  
  15. def test_postgres_service(host):
  16. pgbouncer_service = host.service('pgbouncer')
  17. assert pgbouncer_service.is_enabled
  18. assert pgbouncer_service.is_running
  19.  
  20.  
  21. def test_config_files(host):
  22. pgbouncer_content = host.file('/etc/pgbouncer/pgbouncer.ini').content
  23.  
  24. assert 'dbname=test_base1 user=postgres_test_user1 \
  25. password=testpw1 host=localhost pool_size=50' in pgbouncer_content
  26. assert 'dbname=test_base2 user=postgres_test_user2 \
  27. password=testpw2 host=localhost pool_size=50' in pgbouncer_content
  28.  
  29. userlist_content = host.file('/etc/pgbouncer/userlist.txt').content
  30.  
  31. assert '"pgbouncer_test_user1" "pgbouncer_testpw1"' in userlist_content
  32. assert '"pgbouncer_test_user2" "pgbouncer_testpw2"' in userlist_content
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement