Skip to content

Commit

Permalink
Move kinesis_stream tests over to just integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Mar 13, 2021
1 parent eb92f36 commit b0a009d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 409 deletions.
1 change: 1 addition & 0 deletions tests/integration/targets/kinesis_stream/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
run_kms_tests: True
kinesis_stream_name: '{{ resource_prefix }}'

kms_cmk_alias_1: '{{ resource_prefix }}-1'
Expand Down
9 changes: 0 additions & 9 deletions tests/integration/targets/kinesis_stream/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
---
# ============================================================
# Known issues:
#
# - (Tag_snake) tag keys get snake_cased in return values
# - (Tag_changed) changing tags doesn't return changed
# - (Enc_snake) return values don't get snake_cased when updating encryption
# - (Enc_disable) disabling encryption Requires key and type be set
# - (Enc_idemp) Updating encryption settings isn't idempotent
#
# ============================================================
- name: 'Setup AWS Module Defaults'
module_defaults:
group/aws:
Expand Down
125 changes: 55 additions & 70 deletions tests/integration/targets/kinesis_stream/tasks/test_encryption.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# Disable (check_mode)
# Disable
#
# Known issue:
# - key_id needs to be in the same form as is already set to return changed=False
#
- name: 'Enable encryption using {{ key_type }} (CHECK_MODE)'
check_mode: yes
kinesis_stream:
Expand All @@ -37,29 +40,57 @@
that:
- result is success
- result is changed
# Merge this into the main assertion when the main return keys are
# snake_cased
- name: 'Assert expected return values'
- result.encryption_type == 'KMS'
- result.key_id in kms_cmk_1
- result.open_shards_count == 1
- result.retention_period_hours == 48
- result.stream_arn == kinesis_stream_arn
- result.stream_name == kinesis_stream_name
- result.stream_status == 'ACTIVE'
- result.tags == kinesis_stream_tags_2

- name: 'Re-Enable encryption using {{ key_type }} (CHECK_MODE)'
kinesis_stream:
name: '{{ kinesis_stream_name }}'
encryption_state: 'enabled'
encryption_type: 'KMS'
key_id: '{{ kinesis_key }}'
check_mode: True
register: result
- name: 'Assert that state is not changed when enabling encryption'
assert:
that:
- result is success
- result is not changed
- result.encryption_type == 'KMS'
- result.key_id in kms_cmk_1
- result.open_shards_count == 1
- result.retention_period_hours == 48
- result.stream_arn == kinesis_stream_arn
- result.stream_name == kinesis_stream_name
- result.stream_status == 'ACTIVE'
#- result.tags == kinesis_stream_tags_2
# XXX BUG (Enc_snake)
ignore_errors: yes
# Merge this into the main assertion when the tag keys are no longer
# snake_cased
- name: 'Assert tags return as expected (tags2)'
- result.tags == kinesis_stream_tags_2

- name: 'Re-Enable encryption using {{ key_type }}'
kinesis_stream:
name: '{{ kinesis_stream_name }}'
encryption_state: 'enabled'
encryption_type: 'KMS'
key_id: '{{ kinesis_key }}'
register: result
- name: 'Assert that state is not changed when enabling encryption'
assert:
that:
- result is success
- result is not changed
- result.encryption_type == 'KMS'
- result.key_id in kms_cmk_1
- result.open_shards_count == 1
- result.retention_period_hours == 48
- result.stream_arn == kinesis_stream_arn
- result.stream_name == kinesis_stream_name
- result.stream_status == 'ACTIVE'
- result.tags == kinesis_stream_tags_2
# XXX BUG (Tag_snake)
ignore_errors: yes

- name: 'Test encryption idempotency comparing {{ key_type }} and ID (CHECK_MODE)'
check_mode: yes
Expand All @@ -69,11 +100,12 @@
encryption_type: 'KMS'
key_id: '{{ kinesis_key_id }}'
register: result
- name: 'Assert state is changed when enabling encryption (CHECK_MODE)'
- name: 'Assert state is not changed when comparing {{ key_id }} and ID (CHECK_MODE)'
assert:
that:
- result is success
- result is not changed
ignore_errors: yes

- name: 'Test encryption idempotency comparing {{ key_type }} and ID'
kinesis_stream:
Expand All @@ -82,34 +114,23 @@
encryption_type: 'KMS'
key_id: '{{ kinesis_key_id }}'
register: result
- name: 'Assert that state is changed when enabling encryption'
- name: 'Assert that state is not changed when comparing {{ key_type }} and ID'
assert:
that:
- result is success
- result is not changed
# Merge this into the main assertion when the main return keys are
# snake_cased
ignore_errors: yes
- name: 'Assert expected return values'
assert:
that:
- result is success
- result.encryption_type == 'KMS'
- result.key_id in kms_cmk_1
- result.open_shards_count == 1
- result.retention_period_hours == 48
- result.stream_arn == kinesis_stream_arn
- result.stream_name == kinesis_stream_name
- result.stream_status == 'ACTIVE'
#- result.tags == kinesis_stream_tags_2
# XXX BUG (Enc_snake)
ignore_errors: yes
# Merge this into the main assertion when the tag keys are no longer
# snake_cased
- name: 'Assert tags return as expected (tags2)'
assert:
that:
- result.tags == kinesis_stream_tags_2
# XXX BUG (Tag_snake)
ignore_errors: yes


- name: 'Test encryption idempotency comparing {{ key_type }} and Alias (CHECK_MODE)'
Expand All @@ -120,12 +141,11 @@
encryption_type: 'KMS'
key_id: '{{ kinesis_key_alias }}'
register: result
- name: 'Assert state is changed when enabling encryption (CHECK_MODE)'
- name: 'Assert state is not changed when comparing {{ key_type }} and Alias (CHECK_MODE)'
assert:
that:
- result is success
- result is not changed
# XXX BUG (Enc_Idemp)
ignore_errors: yes

- name: 'Test encryption idempotency comparing {{ key_type }} and Alias'
Expand All @@ -135,36 +155,23 @@
encryption_type: 'KMS'
key_id: '{{ kinesis_key_alias }}'
register: result
- name: 'Assert that state is changed when enabling encryption'
- name: 'Assert that state is not changed when comparing {{ key_type }} and Alias'
assert:
that:
- result is success
- result is not changed
# XXX BUG (Enc_Idemp)
ignore_errors: yes
# Merge this into the main assertion when the main return keys are
# snake_cased
- name: 'Assert expected return values'
assert:
that:
- result is success
- result.encryption_type == 'KMS'
- result.key_id in kms_cmk_1
- result.open_shards_count == 1
- result.retention_period_hours == 48
- result.stream_arn == kinesis_stream_arn
- result.stream_name == kinesis_stream_name
- result.stream_status == 'ACTIVE'
#- result.tags == kinesis_stream_tags_2
# XXX BUG (Enc_snake)
ignore_errors: yes
# Merge this into the main assertion when the tag keys are no longer
# snake_cased
- name: 'Assert tags return as expected (tags2)'
assert:
that:
- result.tags == kinesis_stream_tags_2
# XXX BUG (Tag_snake)
ignore_errors: yes

- name: 'Test encryption idempotency comparing {{ key_type }} and ARN (CHECK_MODE)'
check_mode: yes
Expand All @@ -174,12 +181,11 @@
encryption_type: 'KMS'
key_id: '{{ kinesis_key_arn }}'
register: result
- name: 'Assert state is changed when enabling encryption (CHECK_MODE)'
- name: 'Assert state is not changed when comparing {{ key_type }} and ARN (CHECK_MODE)'
assert:
that:
- result is success
- result is not changed
# XXX BUG (Enc_Idemp)
ignore_errors: yes

- name: 'Test encryption idempotency comparing {{ key_type }} and ARN'
Expand All @@ -189,45 +195,33 @@
encryption_type: 'KMS'
key_id: '{{ kinesis_key_arn }}'
register: result
- name: 'Assert that state is changed when enabling encryption'
- name: 'Assert that state is not changed when comparing {{ key_type }} and ARN'
assert:
that:
- result is success
- result is not changed
ignore_errors: yes
# Merge this into the main assertion when the main return keys are
# snake_cased
- name: 'Assert expected return values'
assert:
that:
- result is success
- result.encryption_type == 'KMS'
- result.key_id in kms_cmk_1
- result.open_shards_count == 1
- result.retention_period_hours == 48
- result.stream_arn == kinesis_stream_arn
- result.stream_name == kinesis_stream_name
- result.stream_status == 'ACTIVE'
#- result.tags == kinesis_stream_tags_2
# XXX BUG (Enc_snake)
ignore_errors: yes
# Merge this into the main assertion when the tag keys are no longer
# snake_cased
- name: 'Assert tags return as expected (tags2)'
assert:
that:
- result.tags == kinesis_stream_tags_2
# XXX BUG (Tag_snake)
ignore_errors: yes

- name: 'Disable encryption (CHECK_MODE)'
kinesis_stream:
name: '{{ kinesis_stream_name }}'
encryption_state: 'disabled'
# XXX BUG (Enc_Disable)
encryption_type: 'KMS'
# XXX Oddity of Kinesis - This needs to match the existing setting
key_id: '{{ kinesis_key_arn }}'
register: result
check_mode: yes
- name: 'Assert state is changed when disabling encryption (CHECK_MODE)'
assert:
that:
Expand All @@ -238,12 +232,11 @@
kinesis_stream:
name: '{{ kinesis_stream_name }}'
encryption_state: 'disabled'
# XXX BUG (Enc_Disable)
encryption_type: 'KMS'
# XXX Oddity of Kinesis - This needs to match the existing setting
key_id: '{{ kinesis_key_arn }}'
register: result
- name: 'Assert state is not changed when disabling encryption'
- name: 'Assert state is changed when disabling encryption'
assert:
that:
- result is success
Expand All @@ -254,12 +247,4 @@
- result.stream_arn == kinesis_stream_arn
- result.stream_name == kinesis_stream_name
- result.stream_status == 'ACTIVE'
#- result.tags == kinesis_stream_tags_2
# Merge this into the main assertion when the tag keys are no longer
# snake_cased
- name: 'Assert tags return as expected (tags2)'
assert:
that:
- result.tags == kinesis_stream_tags_2
# XXX BUG (Tag_snake)
ignore_errors: yes
Loading

0 comments on commit b0a009d

Please sign in to comment.