From 3cde447eb80785a01f3406ffa4b65f3d9fb8bd33 Mon Sep 17 00:00:00 2001 From: Andrew Klychkov Date: Thu, 2 Jul 2020 10:01:20 +0300 Subject: [PATCH] postgresql CI tests: fix timeouts (#598) * postgresql CI tests: fix timeouts * fix ci_complete --- .../tasks/postgresql_slot_initial.yml | 21 ++++++++- .../tasks/postgresql_user_obj_stat_info.yml | 21 ++++++++- .../setup_postgresql_db/tasks/main.yml | 44 +++++++++++++++++-- 3 files changed, 79 insertions(+), 7 deletions(-) diff --git a/tests/integration/targets/postgresql_slot/tasks/postgresql_slot_initial.yml b/tests/integration/targets/postgresql_slot/tasks/postgresql_slot_initial.yml index 8a60b6d0f3..0ca4a349e0 100644 --- a/tests/integration/targets/postgresql_slot/tasks/postgresql_slot_initial.yml +++ b/tests/integration/targets/postgresql_slot/tasks/postgresql_slot_initial.yml @@ -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: restarted + 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: started # # state=present diff --git a/tests/integration/targets/postgresql_user_obj_stat_info/tasks/postgresql_user_obj_stat_info.yml b/tests/integration/targets/postgresql_user_obj_stat_info/tasks/postgresql_user_obj_stat_info.yml index 395e2fc64d..378baf7c97 100644 --- a/tests/integration/targets/postgresql_user_obj_stat_info/tasks/postgresql_user_obj_stat_info.yml +++ b/tests/integration/targets/postgresql_user_obj_stat_info/tasks/postgresql_user_obj_stat_info.yml @@ -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: restarted + state: stopped + + - name: Pause between stop and start PosgreSQL + pause: + seconds: 5 + + - name: Start PostgreSQL + become: yes + service: + name: "{{ postgresql_service }}" + state: started - name: Create test functions <<: *task_parameters diff --git a/tests/integration/targets/setup_postgresql_db/tasks/main.yml b/tests/integration/targets/setup_postgresql_db/tasks/main.yml index 24a121930e..b6898d863d 100644 --- a/tests/integration/targets/setup_postgresql_db/tasks/main.yml +++ b/tests/integration/targets/setup_postgresql_db/tasks/main.yml @@ -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: '' @@ -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 @@ -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 @@ -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: