summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Elrod <rick@elrod.me>2021-02-18 14:55:40 -0600
committerGitHub <noreply@github.com>2021-02-18 14:55:40 -0600
commit83fc193cb62a0e6aabe9e17a7e054326741daca3 (patch)
tree1203ef340ba0c3b72470b8f085a5eefcf62a24e4
parentb20547af70c724f8d8bd2ca83ebb1c901813f354 (diff)
downloadansible-83fc193cb62a0e6aabe9e17a7e054326741daca3.tar.gz
[mongodb tests] Wait for ports in TIME_WAIT (#73655)
Change: - The latest mongodb we install causes processes to not die correctly (they end up as zombies), and this causes the ports they listen on to be held in TIME_WAIT. We need to wait for them to fall out of TIME_WAIT before we can continue and use them again. Test Plan: - CI - Local playing in containers Signed-off-by: Rick Elrod <rick@elrod.me>
-rw-r--r--test/integration/targets/mongodb_replicaset/tasks/main.yml13
-rw-r--r--test/integration/targets/mongodb_replicaset/tasks/mongod_teardown.yml14
-rw-r--r--test/integration/targets/mongodb_shard/tasks/main.yml13
-rw-r--r--test/integration/targets/mongodb_shard/tasks/mongod_teardown.yml14
-rw-r--r--test/integration/targets/setup_mongodb/tasks/main.yml40
5 files changed, 25 insertions, 69 deletions
diff --git a/test/integration/targets/mongodb_replicaset/tasks/main.yml b/test/integration/targets/mongodb_replicaset/tasks/main.yml
index 308e5a44c5..2355c10e3d 100644
--- a/test/integration/targets/mongodb_replicaset/tasks/main.yml
+++ b/test/integration/targets/mongodb_replicaset/tasks/main.yml
@@ -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 }}"
diff --git a/test/integration/targets/mongodb_replicaset/tasks/mongod_teardown.yml b/test/integration/targets/mongodb_replicaset/tasks/mongod_teardown.yml
index 7bc5d3d0a0..6365db7b86 100644
--- a/test/integration/targets/mongodb_replicaset/tasks/mongod_teardown.yml
+++ b/test/integration/targets/mongodb_replicaset/tasks/mongod_teardown.yml
@@ -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:
diff --git a/test/integration/targets/mongodb_shard/tasks/main.yml b/test/integration/targets/mongodb_shard/tasks/main.yml
index d237fa34d4..4142107e87 100644
--- a/test/integration/targets/mongodb_shard/tasks/main.yml
+++ b/test/integration/targets/mongodb_shard/tasks/main.yml
@@ -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 }}"
diff --git a/test/integration/targets/mongodb_shard/tasks/mongod_teardown.yml b/test/integration/targets/mongodb_shard/tasks/mongod_teardown.yml
index 3af09d59be..abf6550ebb 100644
--- a/test/integration/targets/mongodb_shard/tasks/mongod_teardown.yml
+++ b/test/integration/targets/mongodb_shard/tasks/mongod_teardown.yml
@@ -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:
diff --git a/test/integration/targets/setup_mongodb/tasks/main.yml b/test/integration/targets/setup_mongodb/tasks/main.yml
index 08f1c589c1..9400c8beda 100644
--- a/test/integration/targets/setup_mongodb/tasks/main.yml
+++ b/test/integration/targets/setup_mongodb/tasks/main.yml
@@ -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:
@@ -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