issue #426: more 2->3 test fixes.

issue510
David Wilson 6 years ago
parent 67f710fd9b
commit a6e6fd14be

@ -1,6 +1,6 @@
# Verify the behaviour of _low_level_execute_command(). # Verify the behaviour of _low_level_execute_command().
- name: integration/action__low_level_execute_command.yml - name: integration/action/low_level_execute_command.yml
hosts: test-targets hosts: test-targets
any_errors_fatal: true any_errors_fatal: true
tasks: tasks:
@ -14,8 +14,8 @@
assert: assert:
that: that:
- 'raw.rc == 0' - 'raw.rc == 0'
- 'raw.stdout_lines == ["2"]' - 'raw.stdout_lines[-1].decode() == "2"'
- 'raw.stdout == "2"' - 'raw.stdout[-1].decode() == "2"'
- name: Run raw module with sudo - name: Run raw module with sudo
become: true become: true
@ -27,6 +27,12 @@
assert: assert:
that: that:
- raw.rc == 0 - raw.rc == 0
# WHY DOES VANILLA ANSIBLE INSERT NEWLINES HERE!?!?!?!?!?!ONE # WHY DOES VANILLA INSERT NEWLINES HERE!?!?!?!?!?!ONE
- raw.stdout in ("\r\nroot\r\n", "root\r\n") #- raw.stdout in ("\r\nroot\r\n", "root\r\n")
- raw.stdout_lines in (["", "root"], ["root"]) - 'raw.stdout.decode().endswith("root\r\n")'
- |
raw.stdout_lines in (
["\r\n".encode()],
["root\r\n".encode()],
["root".encode()],
)

@ -13,22 +13,22 @@
dest: /tmp/synchronize-action-key dest: /tmp/synchronize-action-key
src: ../../../data/docker/mitogen__has_sudo_pubkey.key src: ../../../data/docker/mitogen__has_sudo_pubkey.key
mode: u=rw,go= mode: u=rw,go=
connection: local delegate_to: localhost
- file: - file:
path: /tmp/sync-test path: /tmp/sync-test
state: absent state: absent
connection: local delegate_to: localhost
- file: - file:
path: /tmp/sync-test path: /tmp/sync-test
state: directory state: directory
connection: local delegate_to: localhost
- copy: - copy:
dest: /tmp/sync-test/item dest: /tmp/sync-test/item
content: "item!" content: "item!"
connection: local delegate_to: localhost
- file: - file:
path: /tmp/sync-test.out path: /tmp/sync-test.out

@ -3,7 +3,7 @@
- shell: dd if=/dev/urandom of=/tmp/{{file_name}} bs=1024 count={{file_size}} - shell: dd if=/dev/urandom of=/tmp/{{file_name}} bs=1024 count={{file_size}}
args: args:
creates: /tmp/{{file_name}} creates: /tmp/{{file_name}}
connection: local delegate_to: localhost
- copy: - copy:
dest: /tmp/{{file_name}}.out dest: /tmp/{{file_name}}.out
@ -11,7 +11,7 @@
- stat: path=/tmp/{{file_name}} - stat: path=/tmp/{{file_name}}
register: original register: original
connection: local delegate_to: localhost
- stat: path=/tmp/{{file_name}}.out - stat: path=/tmp/{{file_name}}.out
register: copied register: copied
@ -19,4 +19,5 @@
- assert: - assert:
that: that:
- original.stat.checksum == copied.stat.checksum - original.stat.checksum == copied.stat.checksum
- (not is_mitogen) or (original.stat.mtime|int == copied.stat.mtime|int) # Upstream does not preserve timestamps at al.
#- (not is_mitogen) or (original.stat.mtime|int == copied.stat.mtime|int)

@ -9,7 +9,7 @@
- meta: end_play - meta: end_play
when: not is_mitogen when: not is_mitogen
- connection: local - delegate_to: localhost
command: | command: |
ansible-playbook ansible-playbook
-i "{{inventory_file}}" -i "{{inventory_file}}"

Loading…
Cancel
Save