Skip to content

Commit

Permalink
postgresql CI tests: fix timeouts (#598)
Browse files Browse the repository at this point in the history
* postgresql CI tests: fix timeouts

* fix

ci_complete
  • Loading branch information
Andersson007 authored Jul 2, 2020
1 parent e2bd4b3 commit 3cde447
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,28 @@
name: wal_level
value: logical

- name: postgresql_slot - restart PostgreSQL
# To avoid CI timeouts
- name: Kill all postgres processes
shell: 'pkill -u {{ pg_user }}'
become: yes
when: ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version == '8'
ignore_errors: yes

- name: postgresql_slot - stop PostgreSQL
become: yes
service:
name: "{{ postgresql_service }}"
state: stopped

- name: postgresql_slot - pause between stop and start PostgreSQL
pause:
seconds: 5

- name: postgresql_slot - start PostgreSQL
become: yes
service:
name: "{{ postgresql_service }}"
state: restarted
state: started

#
# state=present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,28 @@
name: track_functions
value: all

- name: Restart PostgreSQL
# To avoid CI timeouts
- name: Kill all postgres processes
shell: 'pkill -u {{ pg_user }}'
become: yes
when: ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version == '8'
ignore_errors: yes

- name: Stop PostgreSQL
become: yes
service:
name: "{{ postgresql_service }}"
state: stopped

- name: Pause between stop and start PosgreSQL
pause:
seconds: 5

- name: Start PostgreSQL
become: yes
service:
name: "{{ postgresql_service }}"
state: restarted
state: started

- name: Create test functions
<<: *task_parameters
Expand Down
44 changes: 41 additions & 3 deletions tests/integration/targets/setup_postgresql_db/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Exit when Suse because it causes CI problems
- meta: end_play
when: ansible_os_family == 'Suse'

- name: python 2
set_fact:
python_suffix: ''
Expand Down Expand Up @@ -26,6 +30,12 @@
state: started
when: ansible_service_mgr == 'systemd' and ansible_distribution == 'Fedora'

- name: Kill all postgres processes
shell: 'pkill -u {{ pg_user }}'
become: yes
when: ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version == '8'
ignore_errors: yes

- name: stop postgresql service
service: name={{ postgresql_service }} state=stopped
ignore_errors: true
Expand Down Expand Up @@ -83,7 +93,16 @@
when: ansible_os_family == 'Debian'

- name: Initialize postgres (Suse)
service: name=postgresql state=restarted
service: name=postgresql state=stopped
when: ansible_os_family == 'Suse'

- name: Pause between stop and start postgresql
pause:
seconds: 5
when: ansible_os_family == 'Suse'

- name: Initialize postgres (Suse)
service: name=postgresql state=started
when: ansible_os_family == 'Suse'

- name: Copy pg_hba into place
Expand Down Expand Up @@ -153,8 +172,27 @@
- name: start postgresql service
service: name={{ postgresql_service }} state=started

- name: restart postgresql service
service: name={{ postgresql_service }} state=restarted
- name: Pause between start and stop
pause:
seconds: 5

- name: Kill all postgres processes
shell: 'pkill -u {{ pg_user }}'
become: yes
when: ansible_facts.distribution == 'CentOS' and ansible_facts.distribution_major_version == '8'
ignore_errors: yes
register: terminate

- name: Stop postgresql service
service: name={{ postgresql_service }} state=stopped
when: terminate is not succeeded

- name: Pause between stop and start
pause:
seconds: 5

- name: Start postgresql service
service: name={{ postgresql_service }} state=started

- name: copy control file for dummy ext
copy:
Expand Down

0 comments on commit 3cde447

Please sign in to comment.