mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
allows loop pause for subseconds (#50461)
* allows loop pause for subseconds * skip test on os x and bsd since date commands lacks nano fixes #49951
This commit is contained in:
@@ -23,6 +23,25 @@
|
||||
that:
|
||||
- '(after.stdout |int) - (before.stdout|int) >= 4'
|
||||
|
||||
- name: test subsecond pause
|
||||
block:
|
||||
- name: Measure time before loop with .5s pause
|
||||
set_fact:
|
||||
times: "{{times|default([]) + [ lookup('pipe','date +%s.%3N') ]}}"
|
||||
with_sequence: count=3
|
||||
loop_control:
|
||||
pause: 0.6
|
||||
|
||||
- name: ensure lag, since there is 3 rounds, and 0.5 seconds between, it should last 1.2 seconds, but allowing leeway due to CI lag
|
||||
assert:
|
||||
that:
|
||||
- tdiff|float >= 1.2
|
||||
- tdiff|int < 3
|
||||
vars:
|
||||
tdiff: '{{ times[2]|float - times[0]|float }}'
|
||||
when:
|
||||
- ansible_facts['distribution'] not in ("MacOSX", "FreeBSD")
|
||||
|
||||
#
|
||||
# Tests of loop syntax with args
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user