Skip to content

Commit

Permalink
test/s3: keep the bucket name lenght under control
Browse files Browse the repository at this point in the history
The bucket_name variable length is 63 or below. If we add a prefix we
can generate an invalid bucket name.

In addition, the test has little value since it just ensures end-point
behaves as expected. The code coverage in the module itself remains
the same.

See: https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html
  • Loading branch information
goneri committed Apr 26, 2021
1 parent 042b8be commit 6011499
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/integration/targets/aws_s3/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@

- name: test create a bucket with a dot in the name
aws_s3:
bucket: "{{ bucket_name + '.bucket' }}"
bucket: "{{ bucket_name | hash('md5') + '.bucket' }}"
mode: create
register: result

Expand All @@ -454,7 +454,7 @@

- name: test delete a bucket with a dot in the name
aws_s3:
bucket: "{{ bucket_name + '.bucket' }}"
bucket: "{{ bucket_name | hash('md5') + '.bucket' }}"
mode: delete
register: result

Expand All @@ -464,7 +464,7 @@

- name: test delete a nonexistent bucket
aws_s3:
bucket: "{{ bucket_name + '.bucket' }}"
bucket: "{{ bucket_name | hash('md5') + '.bucket' }}"
mode: delete
register: result

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
bucket_name: '{{ resource_prefix }}-{{ inventory_hostname | regex_replace("_","-") }}'
bucket_name: '{{ resource_prefix }}'

0 comments on commit 6011499

Please sign in to comment.