Skip to content

Commit 23d9d0b

Browse files
authored
Merge pull request #1060 from moreati/issue1059
Speed up test suite
2 parents 0ce9ffc + 7079a07 commit 23d9d0b

22 files changed

+175
-35
lines changed

docs/ansible_detailed.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ Noteworthy Differences
247247
part of the core library, and should therefore be straightforward to fix as
248248
part of 0.2.x.
249249

250+
* Connection and become timeouts are applied differently. Mitogen may consider
251+
a connection to have timed out, when Ansible would have waited longer or
252+
indefinately. For example if SSH authentication completes within the
253+
timeout, but execution of login scripts exceeds it - then Mitogen will
254+
consider the task to have timed out and that host to have failed.
255+
256+
..
257+
tests/ansible/integration/ssh/timeouts.yml covers (some of) this behaviour.
258+
250259
..
251260
* SSH and ``become`` are treated distinctly when applying timeouts, and
252261
timeouts apply up to the point when the new interpreter is ready to accept

tests/ansible/bench/file_transfer.yml

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
21
- name: bench/file_transfer.yml
32
hosts: test-targets
43
tasks:
5-
64
- name: Make 32MiB file
75
delegate_to: localhost
6+
run_once: true
87
shell: openssl rand 33554432 > /tmp/bigfile.in
8+
args:
9+
creates: /tmp/bigfile.in
910

1011
- name: Make 320MiB file
1112
delegate_to: localhost
13+
run_once: true
1214
shell: >
1315
cat
1416
/tmp/bigfile.in
@@ -22,6 +24,8 @@
2224
/tmp/bigfile.in
2325
/tmp/bigfile.in
2426
> /tmp/bigbigfile.in
27+
args:
28+
creates: /tmp/bigbigfile.in
2529

2630
- name: Delete SSH file is present.
2731
file:
@@ -36,17 +40,20 @@
3640
copy:
3741
src: /tmp/bigfile.in
3842
dest: /tmp/bigfile.out
43+
mode: ugo=rw
3944

4045
- name: Copy 320MiB file via SSH
4146
copy:
4247
src: /tmp/bigbigfile.in
4348
dest: /tmp/bigbigfile.out
49+
mode: ugo=rw
4450

4551
- name: Delete localhost sudo file if present.
4652
file:
4753
path: "{{item}}"
4854
state: absent
4955
delegate_to: localhost
56+
run_once: true
5057
become: true
5158
with_items:
5259
- /tmp/bigfile.out
@@ -56,21 +63,51 @@
5663

5764
- name: Copy 32MiB file via localhost sudo
5865
delegate_to: localhost
66+
run_once: true
5967
become: true
6068
copy:
6169
src: /tmp/bigfile.in
6270
dest: /tmp/bigfile.out
71+
mode: ugo=rw
6372
tags:
6473
- requires_local_sudo
6574

6675
- name: Copy 320MiB file via localhost sudo
6776
delegate_to: localhost
77+
run_once: true
6878
become: true
6979
copy:
7080
src: /tmp/bigbigfile.in
7181
dest: /tmp/bigbigfile.out
82+
mode: ugo=rw
7283
tags:
7384
- requires_local_sudo
7485

86+
- name: Local cleanup
87+
file:
88+
path: "{{ item.path }}"
89+
state: absent
90+
loop:
91+
- /tmp/bigfile.in
92+
- /tmp/bigfile.out
93+
- /tmp/bigbigfile.in
94+
- /tmp/bigbigfile.out
95+
delegate_to: localhost
96+
run_once: true
97+
tags:
98+
- cleanup_local
99+
- cleanup
100+
101+
- name: Target cleanup
102+
file:
103+
path: "{{ item.path }}"
104+
state: absent
105+
loop:
106+
- /tmp/bigfile.out
107+
- /tmp/bigbigfile.out
108+
tags:
109+
- cleanup_target
110+
- cleanup
111+
75112
tags:
76113
- resource_intensive

tests/ansible/integration/action/copy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
content:
1010
this is a tiny file.
1111
delegate_to: localhost
12+
run_once: true
1213

1314
- name: Create large file
1415
copy:
1516
dest: /tmp/copy-large-file
1617
# Must be larger than Connection.SMALL_SIZE_LIMIT.
1718
content: "{% for x in range(200000) %}x{% endfor %}"
1819
delegate_to: localhost
20+
run_once: true
1921

2022
- name: Cleanup copied files
2123
file:

tests/ansible/integration/action/fixup_perms2__copy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
- name: Create local weird mode file
4040
delegate_to: localhost
41+
run_once: true
4142
copy:
4243
content: "weird mode"
4344
dest: "/tmp/weird-mode"

tests/ansible/integration/action/synchronize.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@
2424
path: /tmp/sync-test
2525
state: absent
2626
delegate_to: localhost
27+
run_once: true
2728

2829
- name: Create sync-test
2930
file:
3031
path: /tmp/sync-test
3132
state: directory
3233
delegate_to: localhost
34+
run_once: true
3335

3436
- name: Create syn-test item
3537
copy:
3638
dest: /tmp/sync-test/item
3739
content: "item!"
3840
delegate_to: localhost
41+
run_once: true
3942

4043
# TODO: https://github.com/dw/mitogen/issues/692
4144
# - file:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
- name: Cleanup local file
2+
file:
3+
path: /tmp/{{ file_name }}
4+
state: absent
5+
delegate_to: localhost
6+
run_once: true
7+
tags:
8+
- cleanup_local
9+
- cleanup
10+
11+
- name: Cleanup target file
12+
file:
13+
path: /tmp/{{ file_name }}.out
14+
state: absent
15+
tags:
16+
- cleanup_target
17+
- cleanup

tests/ansible/integration/connection/_put_file.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
---
2-
31
- name: Create {{ file_name }}
4-
shell: dd if=/dev/urandom of=/tmp/{{ file_name }} bs=1024 count={{ file_size }}
5-
args:
2+
command:
3+
cmd: dd if=/dev/urandom of=/tmp/{{ file_name }} bs=1024 count={{ file_size_kib }}
64
creates: /tmp/{{file_name}}
75
delegate_to: localhost
6+
run_once: true
87

98
- name: Copy {{ file_name }}
109
copy:
1110
dest: /tmp/{{file_name}}.out
1211
src: /tmp/{{file_name}}
12+
mode: "{{ file_mode }}"
1313

1414
- name: Stat created {{ file_name }}
1515
stat: path=/tmp/{{ file_name }}
1616
register: original
1717
delegate_to: localhost
18+
run_once: true
1819

1920
- name: Stat copied {{ file_name }}
2021
stat: path=/tmp/{{ file_name }}.out

tests/ansible/integration/connection/disconnect_during_module.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
- name: Run _disconnect_during_module.yml
1212
delegate_to: localhost
13+
environment:
14+
ANSIBLE_VERBOSITY: "{{ ansible_verbosity }}"
1315
command: |
1416
ansible-playbook
1517
{% for inv in ansible_inventory_sources %}

tests/ansible/integration/connection/put_large_file.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
gather_facts: no
77
vars:
88
file_name: large-file
9-
file_size: 512
9+
file_size_kib: 512
10+
file_mode: u=rw,go=
1011
tasks:
1112
- include_tasks: _put_file.yml
13+
- include_tasks: _cleanup_file.yml
1214
tags:
1315
- put_file
1416
- put_large_file

tests/ansible/integration/connection/put_small_file.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
gather_facts: no
77
vars:
88
file_name: small-file
9-
file_size: 123
9+
file_size_kib: 123
10+
file_mode: u=rw,go=
1011
tasks:
1112
- include_tasks: _put_file.yml
13+
- include_tasks: _cleanup_file.yml
1214
tags:
1315
- put_file
1416
- put_small_file

0 commit comments

Comments
 (0)