File: result_shell_echo_hi.yml

package info (click to toggle)
python-mitogen 0.3.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 6,456 kB
  • sloc: python: 22,134; sh: 183; makefile: 74; perl: 19; ansic: 18
file content (60 lines) | stat: -rw-r--r-- 2,174 bytes parent folder | download | duplicates (2)
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
54
55
56
57
58
59
60

- name: integration/async/result_shell_echo_hi.yml
  gather_facts: true
  hosts: test-targets
  tasks:

  - name: Async shell
    shell: echo hi; echo there >&2
    async: 100
    poll: 0
    register: job

  - name: Sleepy shell
    shell: sleep 1

  - name: Slurp async shell
    slurp:
      src: "{{ansible_user_dir}}/.ansible_async/{{job.ansible_job_id}}"
    register: result

  #- debug: msg="{{result.content|b64decode|from_json}}"

  - assert:
      that:
        - async_out.changed == True
        - async_out.cmd == "echo hi; echo there >&2"
        - 'async_out.delta.startswith("0:00:")'
        - async_out.end.startswith("20")
        - async_out.invocation.module_args._raw_params == "echo hi; echo there >&2"
        - async_out.invocation.module_args._uses_shell == True
        - async_out.invocation.module_args.chdir == None
        - async_out.invocation.module_args.creates == None
        - async_out.invocation.module_args.executable == None
        - async_out.invocation.module_args.removes == None
        # | Ansible <= 3  | ansible-core <= 2.10      | present     | True  |
        # | Ansible 4 - 6 | ansible-core 2.11 - 2.13  | deprecated  | False |
        # | Ansible >= 7  | ansible-core >= 2.14      | absent      | n/a   |
        - (ansible_version_major_minor is version("2.14", ">=", strict=True) and async_out.invocation.module_args.warn is not defined)
          or (ansible_version_major_minor is version("2.11", ">=", strict=True) and async_out.invocation.module_args.warn == False)
          or (async_out.invocation.module_args.warn == True)
        - async_out.rc == 0
        - async_out.start.startswith("20")
        - async_out.stderr == "there"
        - async_out.stdout == "hi"
      fail_msg: |
        async_out={{ async_out }}
    vars:
      async_out: "{{result.content|b64decode|from_json}}"

  - assert:
      that:
        - async_out.invocation.module_args.stdin == None
      fail_msg: |
        async_out={{ async_out }}
    when:
      - ansible_version_major_minor is version('2.4', '>=', strict=True)
    vars:
      async_out: "{{result.content|b64decode|from_json}}"
  tags:
    - result_shell_echo_hi