From f3e07723cdd22ef9eca5997c73ae5ec3a1b484fe Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2020 11:17:05 +0100 Subject: [PATCH] Try to make pids test more stable. (#1160) (#1162) (cherry picked from commit 6d960e9e10758e6362ed47634ea398aedcfeea82) Co-authored-by: Felix Fontein --- tests/integration/targets/pids/tasks/main.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/integration/targets/pids/tasks/main.yml b/tests/integration/targets/pids/tasks/main.yml index 3dad303c62..4cc691633c 100644 --- a/tests/integration/targets/pids/tasks/main.yml +++ b/tests/integration/targets/pids/tasks/main.yml @@ -23,33 +23,37 @@ - emptypids.pids == [] - name: "Picking a random process name" - command: "echo 'some-random-long-name-{{ 99999999 | random }}'" - register: random_name + set_fact: + random_name: some-random-long-name-{{ 99999999 | random }} - name: "finding the 'sleep' binary" command: which sleep register: find_sleep -- name: "copying 'sleep' binary" +- name: "Copying 'sleep' binary" copy: src: "{{ find_sleep.stdout }}" - dest: "{{ output_dir }}/{{ random_name.stdout }}" + dest: "{{ output_dir }}/{{ random_name }}" mode: "0777" - name: "Running the copy of 'sleep' binary" - command: "sh {{ role_path }}/files/obtainpid.sh '{{ output_dir }}/{{ random_name.stdout }}' '{{ output_dir }}/obtainpid.txt'" + command: "sh {{ role_path }}/files/obtainpid.sh '{{ output_dir }}/{{ random_name }}' '{{ output_dir }}/obtainpid.txt'" async: 100 poll: 0 +- name: "Wait for one second to make sure that the sleep copy has actually been started" + pause: + seconds: 1 + - name: "Checking the process IDs (PIDs) of sleep binary" pids: - name: "{{ random_name.stdout }}" + name: "{{ random_name }}" register: pids - name: "Checking that exact non-substring matches are required" pids: - name: "{{ random_name.stdout[0:5] }}" + name: "{{ random_name[0:5] }}" register: exactpidmatch - name: "Reading pid from the file"