Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mongodb tests] Wait for ports in TIME_WAIT [2.9] #73655

Merged
merged 1 commit into from Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 4 additions & 9 deletions test/integration/targets/mongodb_replicaset/tasks/main.yml
Expand Up @@ -78,16 +78,11 @@
- name: Murder all mongod processes
shell: pkill -{{ kill_signal }} mongod;

- name: Getting pids for mongod
pids:
name: mongod
register: pids_of_mongod

- name: Wait for all mongod processes to exit
- name: Wait for ports to get out of TIME_WAIT
wait_for:
path: "/proc/{{ item }}/status"
state: absent
with_items: "{{ pids_of_mongod.pids }}"
port: '{{ item }}'
state: drained
with_sequence: start=3001 end=3003

- set_fact:
current_replicaset: "{{ mongodb_replicaset1 }}"
Expand Down
Expand Up @@ -2,17 +2,11 @@
command: pkill -{{ kill_signal }} mongod
ignore_errors: true

- name: Getting pids for mongod
pids:
name: mongod
register: pids_of_mongod

- name: Wait for all mongod processes to exit
- name: Wait for ports to get out of TIME_WAIT
wait_for:
path: "/proc/{{ item }}/status"
state: absent
delay: 1
with_items: "{{ pids_of_mongod }}"
port: '{{ item }}'
state: drained
with_sequence: start=3001 end=3003

- name: Remove all mongod folders
file:
Expand Down
13 changes: 4 additions & 9 deletions test/integration/targets/mongodb_shard/tasks/main.yml
Expand Up @@ -289,16 +289,11 @@
- name: Murder all mongod processes
shell: pkill -{{ kill_signal }} mongod || true;

- name: Getting pids for mongod
pids:
name: mongod
register: pids_of_mongod

- name: Wait for all mongod processes to exit
- name: Wait for ports to get out of TIME_WAIT
wait_for:
path: "/proc/{{ item }}/status"
state: absent
with_items: "{{ pids_of_mongod }}"
port: '{{ item }}'
state: drained
with_sequence: start=3001 end=3006

- set_fact:
current_replicaset: "{{ mongodb_replicaset1 }}"
Expand Down
14 changes: 4 additions & 10 deletions test/integration/targets/mongodb_shard/tasks/mongod_teardown.yml
Expand Up @@ -6,17 +6,11 @@
command: pkill -{{ kill_signal }} mongos
ignore_errors: true

- name: Getting pids for mongod
pids:
name: mongod
register: pids_of_mongod

- name: Wait for all mongod processes to exit
- name: Wait for ports to get out of TIME_WAIT
wait_for:
path: "/proc/{{ item }}/status"
state: absent
delay: 1
with_items: "{{ pids_of_mongod }}"
port: '{{ item }}'
state: drained
with_sequence: start=3001 end=3006

- name: Remove all mongod folders
file:
Expand Down
40 changes: 9 additions & 31 deletions test/integration/targets/setup_mongodb/tasks/main.yml
Expand Up @@ -69,23 +69,10 @@
# Need to handle various platforms here. Package name will not always be the same
- name: Ensure mongod package is installed
apt:
name: "{{ mongodb_packages.mongod }}"
state: present
force: yes
when:
- ansible_distribution == 'Ubuntu'

- name: Ensure mongos package is installed
apt:
name: "{{ mongodb_packages.mongos }}"
state: present
force: yes
when:
- ansible_distribution == 'Ubuntu'

- name: Ensure mongo client is installed
apt:
name: "{{ mongodb_packages.mongo }}"
name:
- "{{ mongodb_packages.mongod }}"
- "{{ mongodb_packages.mongos }}"
- "{{ mongodb_packages.mongo }}"
state: present
force: yes
when:
Expand Down Expand Up @@ -128,21 +115,12 @@
when:
- ansible_distribution == "Fedora"

- name: Ensure mongod package is installed
yum:
name: "{{ mongodb_packages.mongod }}"
state: present
when: ansible_os_family == "RedHat"

- name: Ensure mongos package is installed
yum:
name: "{{ mongodb_packages.mongos }}"
state: present
when: ansible_os_family == "RedHat"

- name: Ensure mongo client is installed
- name: Ensure mongodb packages are installed
yum:
name: "{{ mongodb_packages.mongo }}"
name:
- "{{ mongodb_packages.mongod }}"
- "{{ mongodb_packages.mongos }}"
- "{{ mongodb_packages.mongo }}"
state: present
when: ansible_os_family == "RedHat"
# EOF Redhat
Expand Down