Skip to content

Commit

Permalink
Turn file names into a variable, and make sure they're unique to the …
Browse files Browse the repository at this point in the history
…host.
  • Loading branch information
tremble committed Feb 13, 2021
1 parent 07de9a9 commit 6ccdc5a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
21 changes: 13 additions & 8 deletions tests/integration/targets/connection/test_connection.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
- hosts: "{{ target_hosts }}"
gather_facts: no
strategy: free
vars:
local_dir: '{{ local_tmp }}-{{ inventory_hostname }}-汉语'
local_file: '{{ local_dir }}/汉语.txt'
remote_dir: '{{ remote_tmp }}-汉语'
remote_file: '{{ remote_dir }}/汉语.txt'
tasks:

### test wait_for_connection plugin
Expand All @@ -20,27 +25,27 @@
### copy local file with unicode filename and content

- name: create local file with unicode filename and content
local_action: lineinfile dest={{ local_tmp }}-汉语/汉语.txt create=true line=汉语
local_action: lineinfile dest={{ local_file }} create=true line=汉语
- name: remove remote file with unicode filename and content
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语/汉语.txt state=absent"
action: "{{ action_prefix }}file path={{ remote_file }} state=absent"
- name: create remote directory with unicode name
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=directory"
action: "{{ action_prefix }}file path={{ remote_dir }} state=directory"
- name: copy local file with unicode filename and content
action: "{{ action_prefix }}copy src={{ local_tmp }}-汉语/汉语.txt dest={{ remote_tmp }}-汉语/汉语.txt"
action: "{{ action_prefix }}copy src={{ local_file }} dest={{ remote_file }}"

### fetch remote file with unicode filename and content

- name: remove local file with unicode filename and content
local_action: file path={{ local_tmp }}-汉语/汉语.txt state=absent
local_action: file path={{ local_file }} state=absent
- name: fetch remote file with unicode filename and content
fetch: src={{ remote_tmp }}-汉语/汉语.txt dest={{ local_tmp }}-汉语/汉语.txt fail_on_missing=true validate_checksum=true flat=true
fetch: src={{ remote_file }} dest={{ local_file }} fail_on_missing=true validate_checksum=true flat=true

### remove local and remote temp files

- name: remove local temp file
local_action: file path={{ local_tmp }}-汉语 state=absent
local_action: file path={{ local_file }} state=absent
- name: remove remote temp file
action: "{{ action_prefix }}file path={{ remote_tmp }}-汉语 state=absent"
action: "{{ action_prefix }}file path={{ remote_file }} state=absent"

### test wait_for_connection plugin
- wait_for_connection:
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

- name: Wait for EC2 to be available
wait_for_connection:
delay: 300
delay: 360

- name: Create S3 bucket
s3_bucket:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ansible_connection=community.aws.aws_ssm
ansible_aws_ssm_bucket_name={{s3_output.name}}
ansible_aws_ssm_plugin=/usr/local/sessionmanagerplugin/bin/session-manager-plugin
ansible_python_interpreter=/usr/bin/env python
local_tmp=/tmp/ansible-local-

# support tests that target testhost
[testhost:children]
Expand Down
1 change: 0 additions & 1 deletion tests/integration/targets/connection_aws_ssm/runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ cd ../connection
# Execute Integration tests
INVENTORY=../connection_aws_ssm/ssm_inventory ./test.sh \
-e target_hosts=aws_ssm \
-e local_tmp=/tmp/ansible-local \
"$@"

0 comments on commit 6ccdc5a

Please sign in to comment.