From Fedora Project Wiki

(quickly create a postgresql server deployment test (reverse-engineered from the openqa test, which was reverse-engineered from rolekit))
 
(add associated release criterion template)
 
Line 1: Line 1:
 +
{{Template:Associated_release_criterion|Basic|postgresql-server-requirements}}
 +
 
{{QA/Test_Case
 
{{QA/Test_Case
 
|description=Test deployment and basic functionality of a [https://www.postgresql.org/ PostgreSQL] server. All commands in this test case should be run as root.
 
|description=Test deployment and basic functionality of a [https://www.postgresql.org/ PostgreSQL] server. All commands in this test case should be run as root.

Latest revision as of 23:28, 17 July 2018

Note.png
Associated release criterion
This test case is associated with the Basic_Release_Criteria#postgresql-server-requirements release criterion. If you are doing release validation testing, a failure of this test case may be a breach of that release criterion. If so, please file a bug and nominate it as blocking the appropriate milestone, using the blocker bug nomination page.


Description

Test deployment and basic functionality of a PostgreSQL server. All commands in this test case should be run as root.

Setup

  1. Perform a typical installation of the Fedora release you wish to run this test on. Boot the system, and log in as root.

How to test

  1. Install the necessary packages:
    dnf -y install postgresql-server postgresql-contrib
  2. Configure the firewall:
    firewall-cmd --permanent --add-service postgresql
    systemctl restart firewalld.service
  3. Initialize the database:
    /usr/bin/postgresql-setup --initdb
  4. Enable and start the systemd service:
    systemctl enable postgresql.service
    systemctl start postgresql.service
  5. Create the database owner:
    su postgres -c "/usr/bin/createuser test"
  6. Create the database:
    su postgres -c "/usr/bin/createdb test -O test"
  7. Set a password for the owner:
    echo "ALTER ROLE test WITH PASSWORD 'correcthorse'" > /tmp/cmd
    su postgres -c "psql test -f /tmp/cmd"
  8. Adjust postgresql.conf to allow network connections:
    sed -i -e "s,.*listen_addresses *=.*,listen_addresses='*',g" /var/lib/pgsql/data/postgresql.conf
  9. Adjust pg_hba.conf to use md5 authentication:
    sed -i -e "s,^host,#host,g" /var/lib/pgsql/data/pg_hba.conf
    echo "host all all all md5" >> /var/lib/pgsql/data/pg_hba.conf
  10. Restart the systemd service:
    systemctl restart postgresql.service
  11. check we can connect to the database and create a table:
    su postgres -c "psql test -c 'CREATE TABLE test (testcol int);'"
  12. check we can add a row to the table:
    su postgres -c "psql test -c 'INSERT INTO test VALUES (5);'"
  13. check we can query the table:
    su postgres -c "psql test -c 'SELECT * FROM test;'"
  14. check we can modify the row:
    su postgres -c "psql test -c 'UPDATE test SET testcol = 50 WHERE testcol = 5;'"
    su postgres -c "psql test -c 'SELECT * FROM test;'"

Expected Results

  1. All commands should run without error
  2. The first SELECT command should show a single row with the value of testcol as 5
  3. The second SELECT command should show a single row with the value of testcol as 50.