File: timeouts.yml

package info (click to toggle)
python-mitogen 0.3.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,456 kB
  • sloc: python: 22,134; sh: 183; makefile: 74; perl: 19; ansic: 18
file content (53 lines) | stat: -rw-r--r-- 1,736 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Ensure 'ssh' connections time out correctly.
# mitogen__slow_user performs a long sleep in ~/.profile.
# Mitogen counts this time towards the connection timeout. Ansible doesn't.
# ansible_python_interpreter=python3000 is an optimisation, to avoid waiting
# on the timeout multiple times (e.g. interpreter discovery).

- name: integration/ssh/timeouts.yml
  hosts: test-targets
  gather_facts: false
  tasks:
    - include_tasks: ../_mitogen_only.yml

    - name: Cause Ansible connection timeout
      connection: local
      environment:
        ANSIBLE_CALLBACK_RESULT_FORMAT: json
        ANSIBLE_LOAD_CALLBACK_PLUGINS: "false"
        ANSIBLE_SSH_TIMEOUT: 10
        ANSIBLE_STRATEGY:  "{{ lookup('env', 'ANSIBLE_STRATEGY') | mandatory }}"
        ANSIBLE_VERBOSITY: "{{ ansible_verbosity }}"
      vars:
        ansible_python_interpreter: "{{ ansible_playbook_python }}"
      command: |
        ansible
        {% for inv in ansible_inventory_sources %}
        -i "{{ inv }}"
        {% endfor %}
        "{{ inventory_hostname }}"
        -m ping
        -e ansible_user=mitogen__slow_user -e ansible_password=slow_user_password
        -e ansible_python_interpreter=python3000
      args:
        chdir: ../..
      register: out
      changed_when: false
      check_mode: false
      ignore_errors: true

    - name: Verify connection timeout occurred
      assert:
        that:
        - |
          '"changed": false' in out.stdout
        - |
          '"unreachable": true' in out.stdout
        - |
          '"msg": "Connection timed out."' in out.stdout
          or '"msg": "Task failed: Connection timed out."' in out.stdout
        fail_msg: |
          out={{ out }}
  tags:
    - mitogen_only
    - timeouts