summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Scherer <mscherer@users.noreply.github.com>2016-09-13 20:12:58 +0200
committerMatt Clay <matt@mystile.com>2016-09-13 11:12:58 -0700
commite9ffe2062fdc2f91e3b274e77d142dec1fae6573 (patch)
tree3d9a9e332c6194449748b3bd3473b9509bf2a3a5
parent8b3ae1e806249e4006645bc40fdf7d2614841703 (diff)
downloadansible-e9ffe2062fdc2f91e3b274e77d142dec1fae6573.tar.gz
Add test for the pause in loop feature (#17336)
See https://github.com/ansible/ansible/pull/17289
-rw-r--r--test/integration/non_destructive.yml2
-rw-r--r--test/integration/roles/test_loops/tasks/main.yml20
2 files changed, 21 insertions, 1 deletions
diff --git a/test/integration/non_destructive.yml b/test/integration/non_destructive.yml
index ec5d194fef..ef70bbaf65 100644
--- a/test/integration/non_destructive.yml
+++ b/test/integration/non_destructive.yml
@@ -43,4 +43,4 @@
- { role: test_embedded_module, tags: test_embedded_module }
- { role: test_add_host, tags: test_add_host }
- { role: test_binary, tags: test_binary }
-
+ - { role: test_loops, tags: test_loops }
diff --git a/test/integration/roles/test_loops/tasks/main.yml b/test/integration/roles/test_loops/tasks/main.yml
new file mode 100644
index 0000000000..7fa6d0d03a
--- /dev/null
+++ b/test/integration/roles/test_loops/tasks/main.yml
@@ -0,0 +1,20 @@
+- name: Measure time before
+ shell: date +%s
+ register: before
+
+- debug:
+ var: i
+ with_sequence: count=3
+ loop_control:
+ loop_var: i
+ pause: 2
+
+- name: Measure time after
+ shell: date +%s
+ register: after
+
+# since there is 3 rounds, and 2 seconds between, it should last 4 seconds
+# we do not test the upper bound, since CI can lag significantly
+- assert:
+ that:
+ - '(after.stdout |int) - (before.stdout|int) >= 4'