Skip to content

Commit

Permalink
tests update
Browse files Browse the repository at this point in the history
  • Loading branch information
marknet15 committed Jan 22, 2022
1 parent 969799a commit d9373a7
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 162 deletions.
1 change: 0 additions & 1 deletion tests/integration/targets/dynamodb_table/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
dependencies:
- prepare_tests
- role: setup_botocore_pip
vars:
botocore_version: "1.23.18"
330 changes: 169 additions & 161 deletions tests/integration/targets/dynamodb_table/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -574,169 +574,177 @@
- delete_table is not changed

# ==============================================
- name: Run tests requiring newer botocore in virtualenv
- name: Create complex table - check_mode
dynamodb_table:
state: present
name: "{{ table_name }}"
hash_key_name: "{{ table_index }}"
hash_key_type: "{{ table_index_type }}"
range_key_name: "{{ range_index }}"
range_key_type: "{{ range_index_type }}"
read_capacity: 3
write_capacity: 3
table_class: "STANDARD_INFREQUENT_ACCESS"
tags: "{{ tags_default }}"
indexes: "{{ indexes }}"
register: create_complex_table
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
check_mode: True

- name: Check results - Create complex table - check_mode
assert:
that:
- create_complex_table is successful
- create_complex_table is changed

- name: Create complex table
dynamodb_table:
state: present
name: "{{ table_name }}"
hash_key_name: "{{ table_index }}"
hash_key_type: "{{ table_index_type }}"
range_key_name: "{{ range_index }}"
range_key_type: "{{ range_index_type }}"
read_capacity: 3
write_capacity: 3
table_class: "STANDARD_INFREQUENT_ACCESS"
tags: "{{ tags_default }}"
indexes: "{{ indexes }}"
register: create_complex_table
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
block:
- name: Create complex table - check_mode
dynamodb_table:
state: present
name: "{{ table_name }}"
hash_key_name: "{{ table_index }}"
hash_key_type: "{{ table_index_type }}"
range_key_name: "{{ range_index }}"
range_key_type: "{{ range_index_type }}"
read_capacity: 3
write_capacity: 3
table_class: "STANDARD_INFREQUENT_ACCESS"
tags: "{{ tags_default }}"
indexes: "{{ indexes }}"
register: create_complex_table
check_mode: True

- name: Check results - Create complex table - check_mode
assert:
that:
- create_complex_table is successful
- create_complex_table is changed

- name: Create complex table
dynamodb_table:
state: present
name: "{{ table_name }}"
hash_key_name: "{{ table_index }}"
hash_key_type: "{{ table_index_type }}"
range_key_name: "{{ range_index }}"
range_key_type: "{{ range_index_type }}"
read_capacity: 3
write_capacity: 3
table_class: "STANDARD_INFREQUENT_ACCESS"
tags: "{{ tags_default }}"
indexes: "{{ indexes }}"
register: create_complex_table

- name: Check results - Create complex table
assert:
that:
- create_complex_table is successful
- create_complex_table is changed
- '"hash_key_name" in create_complex_table'
- '"hash_key_type" in create_complex_table'
- '"indexes" in create_complex_table'
- '"range_key_name" in create_complex_table'
- '"range_key_type" in create_complex_table'
- '"read_capacity" in create_complex_table'
- '"region" in create_complex_table'
- '"table_name" in create_complex_table'
- '"table_status" in create_complex_table'
- '"tags" in create_complex_table'
- '"write_capacity" in create_complex_table'
- create_complex_table.hash_key_name == table_index
- create_complex_table.hash_key_type == table_index_type
- create_complex_table.indexes | length == 2
- create_complex_table.range_key_name == range_index
- create_complex_table.range_key_type == range_index_type
- create_complex_table.read_capacity == 3
- create_complex_table.table_name == table_name
- create_complex_table.table_class == "STANDARD_INFREQUENT_ACCESS"
- create_complex_table.write_capacity == 3
- create_complex_table.tags == tags_default

- name: Create complex table - idempotent - check_mode
dynamodb_table:
state: present
name: "{{ table_name }}"
hash_key_name: "{{ table_index }}"
hash_key_type: "{{ table_index_type }}"
range_key_name: "{{ range_index }}"
range_key_type: "{{ range_index_type }}"
read_capacity: 3
write_capacity: 3
table_class: "STANDARD_INFREQUENT_ACCESS"
tags: "{{ tags_default }}"
indexes: "{{ indexes }}"
register: create_complex_table
check_mode: True

- name: Check results - Create complex table - idempotent - check_mode
assert:
that:
- create_complex_table is successful
- create_complex_table is not changed

- name: Create complex table - idempotent
dynamodb_table:
state: present
name: "{{ table_name }}"
hash_key_name: "{{ table_index }}"
hash_key_type: "{{ table_index_type }}"
range_key_name: "{{ range_index }}"
range_key_type: "{{ range_index_type }}"
read_capacity: 3
write_capacity: 3
table_class: "STANDARD_INFREQUENT_ACCESS"
tags: "{{ tags_default }}"
indexes: "{{ indexes }}"
register: create_complex_table

- name: Check results - Create complex table - idempotent
assert:
that:
- create_complex_table is successful
- create_complex_table is not changed
- '"hash_key_name" in create_complex_table'
- '"hash_key_type" in create_complex_table'
- '"indexes" in create_complex_table'
- '"range_key_name" in create_complex_table'
- '"range_key_type" in create_complex_table'
- '"read_capacity" in create_complex_table'
- '"region" in create_complex_table'
- '"table_name" in create_complex_table'
- '"table_status" in create_complex_table'
- '"tags" in create_complex_table'
- '"write_capacity" in create_complex_table'
- create_complex_table.hash_key_name == table_index
- create_complex_table.hash_key_type == table_index_type
- create_complex_table.indexes | length == 2
- create_complex_table.range_key_name == range_index
- create_complex_table.range_key_type == range_index_type
- create_complex_table.read_capacity == 3
- create_complex_table.table_name == table_name
- create_complex_table.table_class == "STANDARD_INFREQUENT_ACCESS"
- create_complex_table.write_capacity == 3
- create_complex_table.tags == tags_default

# ==============================================
# Update table class on exisiting table

- name: Update table class - check_mode
dynamodb_table:
state: present
name: "{{ table_name }}"
table_class: "STANDARD"
register: update_class
check_mode: True

- name: Check results - Update table class - check_mode
assert:
that:
- update_class is successful
- update_class is changed

- name: Update table class
dynamodb_table:
state: present
name: "{{ table_name }}"
table_class: "STANDARD"
register: update_class

- name: Check results - Update table class
assert:
that:
- update_class is successful
- update_class is changed
- update_class.table_name == table_name
- update_class.table_class == "STANDARD"

- name: Check results - Create complex table
assert:
that:
- create_complex_table is successful
- create_complex_table is changed
- '"hash_key_name" in create_complex_table'
- '"hash_key_type" in create_complex_table'
- '"indexes" in create_complex_table'
- '"range_key_name" in create_complex_table'
- '"range_key_type" in create_complex_table'
- '"read_capacity" in create_complex_table'
- '"region" in create_complex_table'
- '"table_name" in create_complex_table'
- '"table_status" in create_complex_table'
- '"tags" in create_complex_table'
- '"write_capacity" in create_complex_table'
- create_complex_table.hash_key_name == table_index
- create_complex_table.hash_key_type == table_index_type
- create_complex_table.indexes | length == 2
- create_complex_table.range_key_name == range_index
- create_complex_table.range_key_type == range_index_type
- create_complex_table.read_capacity == 3
- create_complex_table.table_name == table_name
- create_complex_table.table_class == "STANDARD_INFREQUENT_ACCESS"
- create_complex_table.write_capacity == 3
- create_complex_table.tags == tags_default

- name: Create complex table - idempotent - check_mode
dynamodb_table:
state: present
name: "{{ table_name }}"
hash_key_name: "{{ table_index }}"
hash_key_type: "{{ table_index_type }}"
range_key_name: "{{ range_index }}"
range_key_type: "{{ range_index_type }}"
read_capacity: 3
write_capacity: 3
table_class: "STANDARD_INFREQUENT_ACCESS"
tags: "{{ tags_default }}"
indexes: "{{ indexes }}"
register: create_complex_table
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
check_mode: True

- name: Check results - Create complex table - idempotent - check_mode
assert:
that:
- create_complex_table is successful
- create_complex_table is not changed

- name: Create complex table - idempotent
dynamodb_table:
state: present
name: "{{ table_name }}"
hash_key_name: "{{ table_index }}"
hash_key_type: "{{ table_index_type }}"
range_key_name: "{{ range_index }}"
range_key_type: "{{ range_index_type }}"
read_capacity: 3
write_capacity: 3
table_class: "STANDARD_INFREQUENT_ACCESS"
tags: "{{ tags_default }}"
indexes: "{{ indexes }}"
register: create_complex_table
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"

- name: Check results - Create complex table - idempotent
assert:
that:
- create_complex_table is successful
- create_complex_table is not changed
- '"hash_key_name" in create_complex_table'
- '"hash_key_type" in create_complex_table'
- '"indexes" in create_complex_table'
- '"range_key_name" in create_complex_table'
- '"range_key_type" in create_complex_table'
- '"read_capacity" in create_complex_table'
- '"region" in create_complex_table'
- '"table_name" in create_complex_table'
- '"table_status" in create_complex_table'
- '"tags" in create_complex_table'
- '"write_capacity" in create_complex_table'
- create_complex_table.hash_key_name == table_index
- create_complex_table.hash_key_type == table_index_type
- create_complex_table.indexes | length == 2
- create_complex_table.range_key_name == range_index
- create_complex_table.range_key_type == range_index_type
- create_complex_table.read_capacity == 3
- create_complex_table.table_name == table_name
- create_complex_table.table_class == "STANDARD_INFREQUENT_ACCESS"
- create_complex_table.write_capacity == 3
- create_complex_table.tags == tags_default

# ==============================================
# Update table class on exisiting table

- name: Update table class - check_mode
dynamodb_table:
state: present
name: "{{ table_name }}"
table_class: "STANDARD"
register: update_class
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
check_mode: True

- name: Check results - Update table class - check_mode
assert:
that:
- update_class is successful
- update_class is changed

- name: Update table class
dynamodb_table:
state: present
name: "{{ table_name }}"
table_class: "STANDARD"
vars:
ansible_python_interpreter: "{{ botocore_virtualenv_interpreter }}"
register: update_class

- name: Check results - Update table class
assert:
that:
- update_class is successful
- update_class is changed
- update_class.table_name == table_name
- update_class.table_class == "STANDARD"

# ==============================================
# Update table index on exisiting table
Expand Down

0 comments on commit d9373a7

Please sign in to comment.