Skip to content

Commit 03acf40

Browse files
committed
tests: Speed up transport config tests by avoiding interpreter discovery
Reduced execution time of tests/ansible/integration/transport_config/all.yml from 11 minutes to 49 seconds.
1 parent 572636a commit 03acf40

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

tests/ansible/hosts/transport_config.hosts

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,76 @@
11
# integration/transport_config
22
# Hosts with twiddled configs that need to be checked somehow.
33

4+
[transport_config:children]
5+
transport_config_undiscover
6+
tc_python_path
47

5-
# tansport()
8+
[transport_config_undiscover:children]
9+
tc_become
10+
tc_become_method
11+
tc_become_pass
12+
tc_become_user
13+
tc_password
14+
tc_port
15+
tc_remote_addr
16+
tc_remote_user
17+
tc_transport
18+
19+
[transport_config_undiscover:vars]
20+
# If python interpreter path is unset, Ansible tries to connect & discover it.
21+
# That causes approx 10 seconds timeout per task - there's no host to connect to.
22+
# This optimisation should not be relied in any test.
23+
# Note: tc-python-path-* are intentionally not included.
24+
ansible_python_interpreter = python3000 # Not expected to exist
25+
26+
[tc_transport]
627
tc-transport-unset
728
tc-transport-local ansible_connection=local
829
tc-transport-smart ansible_connection=smart
930

10-
# python_path()
31+
[tc_python_path]
1132
tc-python-path-unset
1233
tc-python-path-hostvar ansible_python_interpreter=/hostvar/path/to/python
1334
tc-python-path-local-unset ansible_connection=local
1435
tc-python-path-local-explicit ansible_connection=local ansible_python_interpreter=/a/b/c
1536

16-
# remote_addr()
37+
[tc_remote_addr]
1738
tc-remote-addr-unset # defaults to inventory_hostname
1839
tc-remote-addr-explicit-ssh ansible_ssh_host=ansi.ssh.host
1940
tc-remote-addr-explicit-host ansible_host=ansi.host
2041
tc-remote-addr-explicit-both ansible_ssh_host=a.b.c ansible_host=b.c.d
2142

22-
# password()
43+
[tc_password]
2344
tc-password-unset
2445
tc-password-explicit-ssh ansible_ssh_pass=ansi-ssh-pass
2546
tc-password-explicit-pass ansible_password=ansi-pass
2647
tc-password-explicit-both ansible_password=a.b.c ansible_ssh_pass=c.b.a
2748

28-
# remote_user()
49+
[tc_remote_user]
2950
tc-remote-user-unset # defaults to C.DEFAULT_REMOTE_USER
3051
tc-remote-user-explicit-ssh ansible_ssh_user=ansi-ssh-user
3152
tc-remote-user-explicit-user ansible_user=ansi-user
3253
tc-remote-user-explicit-both ansible_user=a.b.c ansible_ssh_user=c.b.a
3354

34-
# become()
55+
[tc_become]
3556
tc-become-unset
3657
tc-become-set
3758

38-
# become_method()
59+
[tc_become_method]
3960
tc-become-method-unset
4061
tc-become-method-su ansible_become_method=su
4162

42-
# become_user()
63+
[tc_become_user]
4364
tc-become-user-unset
4465
tc-become-user-set ansible_become_user=ansi-become-user
4566

46-
# become_pass()
67+
[tc_become_pass]
4768
tc-become-pass-unset
4869
tc-become-pass-password ansible_become_password=apassword
4970
tc-become-pass-pass ansible_become_pass=apass
5071
tc-become-pass-both ansible_become_pass=bpass ansible_become_password=bpassword
5172

52-
# port()
73+
[tc_port]
5374
tc-port-unset
5475
tc-port-explicit-port ansible_port=1234
5576
tc-port-explicit-ssh ansible_ssh_port=4321

0 commit comments

Comments
 (0)