From 6ccdc5ac2c02a551cb3e3ac1dad0a1823138e10d Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Wed, 25 Nov 2020 10:52:03 +0100 Subject: [PATCH] Turn file names into a variable, and make sure they're unique to the host. --- .../targets/connection/test_connection.yml | 21 ++++++++++++------- .../tasks/main.yml | 2 +- .../templates/inventory-combined.aws_ssm.j2 | 1 + .../targets/connection_aws_ssm/runme.sh | 1 - 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/integration/targets/connection/test_connection.yml b/tests/integration/targets/connection/test_connection.yml index b746d8bc243..e763ce35c75 100644 --- a/tests/integration/targets/connection/test_connection.yml +++ b/tests/integration/targets/connection/test_connection.yml @@ -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 @@ -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: diff --git a/tests/integration/targets/connection_aws_ssm/aws_ssm_integration_test_setup/tasks/main.yml b/tests/integration/targets/connection_aws_ssm/aws_ssm_integration_test_setup/tasks/main.yml index 240e5e085e5..a2aab0a3380 100644 --- a/tests/integration/targets/connection_aws_ssm/aws_ssm_integration_test_setup/tasks/main.yml +++ b/tests/integration/targets/connection_aws_ssm/aws_ssm_integration_test_setup/tasks/main.yml @@ -98,7 +98,7 @@ - name: Wait for EC2 to be available wait_for_connection: - delay: 300 + delay: 360 - name: Create S3 bucket s3_bucket: diff --git a/tests/integration/targets/connection_aws_ssm/aws_ssm_integration_test_setup/templates/inventory-combined.aws_ssm.j2 b/tests/integration/targets/connection_aws_ssm/aws_ssm_integration_test_setup/templates/inventory-combined.aws_ssm.j2 index 02df5d8cb1a..c32f60d95c2 100644 --- a/tests/integration/targets/connection_aws_ssm/aws_ssm_integration_test_setup/templates/inventory-combined.aws_ssm.j2 +++ b/tests/integration/targets/connection_aws_ssm/aws_ssm_integration_test_setup/templates/inventory-combined.aws_ssm.j2 @@ -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] diff --git a/tests/integration/targets/connection_aws_ssm/runme.sh b/tests/integration/targets/connection_aws_ssm/runme.sh index 9d354b8812d..e40675a5f3e 100755 --- a/tests/integration/targets/connection_aws_ssm/runme.sh +++ b/tests/integration/targets/connection_aws_ssm/runme.sh @@ -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 \ "$@"