Skip to content

Commit

Permalink
Update OBJ tests and examples (#633)
Browse files Browse the repository at this point in the history
* Update version of the AWS Collection

* Update obj tests
  • Loading branch information
zliang-akamai authored Dec 12, 2024
1 parent 9729ec7 commit 88e6107
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/integration-tests-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ jobs:
fetch-depth: 0
submodules: 'recursive'

# Install deps
- name: update packages
run: sudo apt-get update -y

- name: install make
run: sudo apt-get install -y build-essential

- name: setup python 3
uses: actions/setup-python@v5
with:
Expand All @@ -55,7 +48,7 @@ jobs:
run: make deps

- name: install ansible dependencies
run: ansible-galaxy collection install amazon.aws:==6.0.1
run: ansible-galaxy collection install amazon.aws:==9.1.0

- name: install collection
run: make install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: make deps

- name: Install ansible dependencies
run: ansible-galaxy collection install amazon.aws:==6.0.1
run: ansible-galaxy collection install amazon.aws:==9.1.0

- name: Install Collection
run: make install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
run: make deps

- name: Install ansible dependencies
run: ansible-galaxy collection install amazon.aws:==6.0.1
run: ansible-galaxy collection install amazon.aws:==9.1.0

- name: Install Collection
run: make install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: make deps

- name: install ansible dependencies
run: ansible-galaxy collection install amazon.aws:==6.0.1
run: ansible-galaxy collection install amazon.aws:==9.1.0

- name: inject docs using specdoc
run: make inject
Expand Down
7 changes: 4 additions & 3 deletions examples/obj_static_site/roles/static_site/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
- name: Create an Object Storage bucket
amazon.aws.s3_bucket:
name: "{{ bucket_name }}"
s3_url: "https://{{ cluster_info.clusters[0].domain }}/"
endpoint_url: "https://{{ cluster_info.clusters[0].domain }}/"
aws_access_key: "{{ obj_key.key.access_key }}"
aws_secret_key: "{{ obj_key.key.secret_key }}"

state: present

- name: Upload the static site files
amazon.aws.aws_s3:
s3_url: "https://{{ cluster_info.clusters[0].domain }}/"
amazon.aws.s3_object:
endpoint_url: "https://{{ cluster_info.clusters[0].domain }}/"
aws_access_key: "{{ obj_key.key.access_key }}"
aws_secret_key: "{{ obj_key.key.secret_key }}"

Expand All @@ -29,6 +29,7 @@
src: "{{ item }}"
mode: put
permission: public-read
ceph: true
with_fileglob: 'roles/static_site/files/public/*.html'

- name: Configure the Object Storage Bucket as a website with index and error pages
Expand Down
10 changes: 7 additions & 3 deletions tests/integration/targets/object_basic/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@

- name: Create an S3 bucket
amazon.aws.s3_bucket:
s3_url: 'http://{{ info_by_id.clusters[0].domain }}/'
endpoint_url: 'https://{{ info_by_id.clusters[0].domain }}/'
aws_access_key: '{{ create_key.key.access_key }}'
aws_secret_key: '{{ create_key.key.secret_key }}'
name: 'test-ansible-bucket-{{ r }}'
ceph: true
region: "default"
state: present
register: create_bucket

Expand Down Expand Up @@ -77,14 +79,16 @@
- create_access.key.bucket_access[1].permissions == 'read_only'

always:
- ignore_errors: yes
- ignore_errors: true
block:
- name: Delete the S3 bucket
amazon.aws.s3_bucket:
s3_url: 'http://{{ info_by_id.clusters[0].domain }}/'
endpoint_url: 'https://{{ info_by_id.clusters[0].domain }}/'
aws_access_key: '{{ create_key.key.access_key }}'
aws_secret_key: '{{ create_key.key.secret_key }}'
name: '{{ create_bucket.name }}'
ceph: true
region: "default"
state: absent
register: delete_bucket

Expand Down
10 changes: 7 additions & 3 deletions tests/integration/targets/object_keys_basic/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@

- name: Create an S3 bucket using the key
amazon.aws.s3_bucket:
s3_url: "https://{{ update.key.regions[0].s3_endpoint }}/"
endpoint_url: "https://{{ update.key.regions[0].s3_endpoint }}/"
aws_access_key: "{{ create.key.access_key }}"
aws_secret_key: "{{ create.key.secret_key }}"
name: "test-ansible-bucket-{{ r }}"
state: present
ceph: true
region: "default"
register: create_bucket

- name: Assert bucket was created
Expand Down Expand Up @@ -137,14 +139,16 @@
failed_when: "'`access` is not an updatable field' not in update_scoped.msg"

always:
- ignore_errors: yes
- ignore_errors: true
block:
- name: Delete the OBJ bucket
amazon.aws.s3_bucket:
s3_url: "https://{{ update.key.regions[0].s3_endpoint }}//"
endpoint_url: "https://{{ update.key.regions[0].s3_endpoint }}//"
aws_access_key: "{{ create.key.access_key }}"
aws_secret_key: "{{ create.key.secret_key }}"
name: "{{ create_bucket.name }}"
ceph: true
region: "default"
state: absent
register: delete_bucket

Expand Down

0 comments on commit 88e6107

Please sign in to comment.