Skip to content

Commit

Permalink
Add tests for PS auth_pam plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tplavcic committed Mar 14, 2018
1 parent 4fae5ff commit ff64a61
Show file tree
Hide file tree
Showing 14 changed files with 515 additions and 4 deletions.
82 changes: 82 additions & 0 deletions playbooks/common_55.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,70 @@
- name: check that Percona XtraBackup package versions are correct
command: /package-testing/package_check.sh pxb23

# Start PAM test
- group:
name: developer
state: present

- group:
name: dbadmin
state: present

- user:
name: test_pam
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1

- user:
name: test_pam2
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1
groups: developer
append: yes

- user:
name: test_pam3
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1
groups: dbadmin
append: yes

- user:
name: test_pam_compat
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1

- user:
name: mysql
groups: shadow
append: yes
when: ansible_os_family == "Debian"

- file:
path: /etc/shadow
group: mysql
mode: "g+r"
when: ansible_os_family == "RedHat"

- name: copy config file for mysql PAM into system dir
template:
src: ../scripts/ps_pam_test/mysqld
dest: /etc/pam.d/mysqld
owner: root
group: root
mode: 0644
force: yes

- name: restart mysql service
service: name=mysql state=restarted

- name: run mysql setup for PAM
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_mysql_setup.bats

- name: run bats tests for PAM
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_test.bats
# End PAM test

# temporary commented out until BLD-906 is fixed
# - name: check that mysqladmin shutdown works correctly
# command: /package-testing/madmin_check.sh
Expand All @@ -128,3 +192,21 @@
with_items:
- rsyslog-mysql
when: ansible_os_family == "RedHat"

- name: uninstall PAM before final package uninstall
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_mysql_uninstall.bats

- name: remove Percona Server deb packages
apt: name={{item}} update_cache=no state=absent
with_items:
- percona-server-server-5.5
when: ansible_os_family == "Debian"

- name: remove Percona Server rpm packages
yum: name={{item}} state=absent
with_items:
- Percona-Server-server-55
when: ansible_os_family == "RedHat"

- name: check if process is stopped after package removal
command: /package-testing/check_running.sh mysql stopped
67 changes: 67 additions & 0 deletions playbooks/common_55_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,67 @@
- rsyslog-mysql
when: ansible_os_family == "RedHat"

# Start PAM test
- group:
name: developer
state: present

- group:
name: dbadmin
state: present

- user:
name: test_pam
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1

- user:
name: test_pam2
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1
groups: developer
append: yes

- user:
name: test_pam3
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1
groups: dbadmin
append: yes

- user:
name: test_pam_compat
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1

- user:
name: mysql
groups: shadow
append: yes
when: ansible_os_family == "Debian"

- file:
path: /etc/shadow
group: mysql
mode: "g+r"
when: ansible_os_family == "RedHat"

- name: copy config file for mysql PAM into system dir
template:
src: ../scripts/ps_pam_test/mysqld
dest: /etc/pam.d/mysqld
owner: root
group: root
mode: 0644
force: yes

- name: restart mysql service
service: name=mysql state=restarted

- name: run mysql setup for PAM
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_mysql_setup.bats
# End PAM test

#
# Enable testing repository
#
Expand Down Expand Up @@ -182,6 +243,9 @@
service: name=mysql state=restarted
when: ansible_os_family != "RedHat" or ansible_distribution_major_version != "5"

- name: run bats tests for PAM
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_test.bats

- name: check that Percona Server version is correct
command: /package-testing/version_check.sh ps55

Expand All @@ -199,3 +263,6 @@

- name: check that sysbench version is correct
command: /package-testing/version_check.sh sysbench

- name: uninstall PAM before final package uninstall
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_mysql_uninstall.bats
67 changes: 67 additions & 0 deletions playbooks/common_56.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,70 @@
- name: check that Percona XtraBackup package versions are correct
command: /package-testing/package_check.sh pxb23

# Start PAM test
- group:
name: developer
state: present

- group:
name: dbadmin
state: present

- user:
name: test_pam
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1

- user:
name: test_pam2
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1
groups: developer
append: yes

- user:
name: test_pam3
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1
groups: dbadmin
append: yes

- user:
name: test_pam_compat
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1

- user:
name: mysql
groups: shadow
append: yes
when: ansible_os_family == "Debian"

- file:
path: /etc/shadow
group: mysql
mode: "g+r"
when: ansible_os_family == "RedHat"

- name: copy config file for mysql PAM into system dir
template:
src: ../scripts/ps_pam_test/mysqld
dest: /etc/pam.d/mysqld
owner: root
group: root
mode: 0644
force: yes

- name: restart mysql service
service: name=mysql state=restarted

- name: run mysql setup for PAM
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_mysql_setup.bats

- name: run bats tests for PAM
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_test.bats
# End PAM test

- name: install 3rd party packages with apt
apt: name={{item}}
with_items:
Expand Down Expand Up @@ -161,6 +225,9 @@
# - name: check that mysqladmin shutdown works correctly
# command: /package-testing/madmin_check.sh

- name: uninstall PAM before final package uninstall
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_mysql_uninstall.bats

- name: remove Percona Server deb packages
apt: name={{item}} update_cache=no state=absent
with_items:
Expand Down
67 changes: 67 additions & 0 deletions playbooks/common_56_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,67 @@
- rsyslog-mysql
when: ansible_os_family == "RedHat"

# Start PAM test
- group:
name: developer
state: present

- group:
name: dbadmin
state: present

- user:
name: test_pam
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1

- user:
name: test_pam2
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1
groups: developer
append: yes

- user:
name: test_pam3
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1
groups: dbadmin
append: yes

- user:
name: test_pam_compat
shell: /bin/bash
password: $6$mrqBDJUyh13p$elUkdb99/v4fPxnLIS2TAXSUhVt16PvOvIPzVqobKKZKHHMRyXOmJ4puhybn0Go0HpL1RNYvREgqF02qYnGOX1

- user:
name: mysql
groups: shadow
append: yes
when: ansible_os_family == "Debian"

- file:
path: /etc/shadow
group: mysql
mode: "g+r"
when: ansible_os_family == "RedHat"

- name: copy config file for mysql PAM into system dir
template:
src: ../scripts/ps_pam_test/mysqld
dest: /etc/pam.d/mysqld
owner: root
group: root
mode: 0644
force: yes

- name: restart mysql service
service: name=mysql state=restarted

- name: run mysql setup for PAM
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_mysql_setup.bats
# End PAM test

#
# Enable testing repository
#
Expand Down Expand Up @@ -217,6 +278,9 @@
- name: check that Percona XtraBackup package versions are correct
command: /package-testing/package_check.sh pxb23

- name: run bats tests for PAM
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_test.bats

- name: run bats unit tests for ps_tokudb_admin scripts
command: /usr/local/bin/bats /package-testing/bats/ps_tokudb_admin_unit.bats

Expand All @@ -229,6 +293,9 @@
- name: start mysql service
service: name=mysql state=started

- name: uninstall PAM before final package uninstall
command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_mysql_uninstall.bats

- name: remove Percona Server deb packages
apt: name={{item}} update_cache=no state=absent
with_items:
Expand Down
Loading

0 comments on commit ff64a61

Please sign in to comment.