From 194019aed56fe5cefc4b7c3ac398fac3cfd71c4d Mon Sep 17 00:00:00 2001 From: JavidMinadathAlimohi Date: Tue, 17 Dec 2024 18:38:03 -0500 Subject: [PATCH] Updated the integration test case for s3_lifecycle to validate minimum and maximum object size settings --- .../targets/s3_lifecycle/tasks/main.yml | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/tests/integration/targets/s3_lifecycle/tasks/main.yml b/tests/integration/targets/s3_lifecycle/tasks/main.yml index d9f169561af..947c356ef47 100644 --- a/tests/integration/targets/s3_lifecycle/tasks/main.yml +++ b/tests/integration/targets/s3_lifecycle/tasks/main.yml @@ -694,6 +694,95 @@ that: - output is changed + # Check create and delete lifecycle policy with minimum and maximum object size (with prefix) + - name: Create rule with minimum and maximum object size + s3_lifecycle: + name: "{{ bucket_name }}" + rule_id: minimum-object-size-prefix + prefix: /something/ + minimum_object_size: 100 + maximum_object_size: 1000 + state: present + status: enabled + expiration_days: 30 + register: output + - assert: + that: + - output is changed + + - name: Create rule with minimum object size (idempotency) + s3_lifecycle: + name: "{{ bucket_name }}" + rule_id: minimum-object-size-prefix + prefix: /something/ + minimum_object_size: 100 + maximum_object_size: 1000 + state: present + status: enabled + expiration_days: 30 + register: output + - assert: + that: + - output is not changed + + - name: Delete rule with minimum and maximum object size + s3_lifecycle: + name: "{{ bucket_name }}" + rule_id: minimum-object-size-prefix + prefix: /something/ + minimum_object_size: 100 + maximum_object_size: 1000 + state: absent + status: enabled + expiration_days: 30 + register: output + - assert: + that: + - output is changed + + # Check create and delete lifecycle policy with minimum and maximum object size (no prefix) + - name: Create rule with minimum and maximum object size + s3_lifecycle: + name: "{{ bucket_name }}" + rule_id: minimum-object-size-noprefix + minimum_object_size: 100 + maximum_object_size: 1000 + state: present + status: enabled + expiration_days: 30 + register: output + - assert: + that: + - output is changed + + - name: Create rule with minimum object size (idempotency) + s3_lifecycle: + name: "{{ bucket_name }}" + rule_id: minimum-object-size-noprefix + minimum_object_size: 100 + maximum_object_size: 1000 + state: present + status: enabled + expiration_days: 30 + register: output + - assert: + that: + - output is not changed + + - name: Delete rule with minimum and maximum object size + s3_lifecycle: + name: "{{ bucket_name }}" + rule_id: minimum-object-size-noprefix + minimum_object_size: 100 + maximum_object_size: 1000 + state: absent + status: enabled + expiration_days: 30 + register: output + - assert: + that: + - output is changed + # ============================================================ always: - name: Ensure all buckets are deleted