mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
4fe08441be
* Warn on tests used as filters * Update docs, add aliases for tests that fit more gramatically with test syntax * Fix rst formatting * Add successful filter, alias of success * Remove renamed_deprecation, it was overkill * Make directory alias for is_dir * Update tests to use proper jinja test syntax * Update additional documentation, living outside of YAML files, to reflect proper jinja test syntax * Add conversion script, porting guide updates, and changelog updates * Update newly added uses of tests as filters * No underscore variable * Convert recent tests as filter changes to win_stat * Fix some changes related to rebasing a few integration tests * Make tests_as_filters_warning explicitly accept the name of the test, instead of inferring the name * Add test for tests_as_filters_warning * Update tests as filters in newly added/modified tests * Address recent changes to several integration tests * Address recent changes in cs_vpc
90 lines
2.4 KiB
YAML
90 lines
2.4 KiB
YAML
- name: add rules to an acl token
|
|
consul_acl:
|
|
mgmt_token: '{{mgmt_token}}'
|
|
host: '{{acl_host}}'
|
|
name: 'ACL rule for testing'
|
|
rules:
|
|
- key: 'somekey'
|
|
policy: write
|
|
register: test_acl
|
|
|
|
- name: cleanup from previous failed runs
|
|
consul_kv: key={{item}} state=absent token='{{test_acl.token}}'
|
|
with_items:
|
|
- somekey
|
|
|
|
- name: add a kv pair to the kv store
|
|
consul_kv: key=somekey value=somevalue token='{{test_acl.token}}'
|
|
register: new_key
|
|
|
|
- name: verify new key
|
|
assert:
|
|
that:
|
|
- new_key.key == 'somekey'
|
|
- new_key.data.Value == 'somevalue'
|
|
- new_key.changed == true
|
|
|
|
- name: add an existing kv to the kv store
|
|
consul_kv: key=somekey value=somevalue token='{{test_acl.token}}'
|
|
register: existing_key
|
|
|
|
- name: verify existing key cause no change
|
|
assert:
|
|
that:
|
|
- existing_key.key == 'somekey'
|
|
- existing_key.data.Value == 'somevalue'
|
|
- existing_key.changed == False
|
|
|
|
- name: remove an existing kv from the kv store
|
|
consul_kv: key=somekey state=absent token='{{test_acl.token}}'
|
|
register: remove_key
|
|
|
|
- name: verify removal causes change and existing value is returned
|
|
assert:
|
|
that:
|
|
- remove_key.key == 'somekey'
|
|
- remove_key.data.Value == 'somevalue'
|
|
- remove_key.changed == True
|
|
|
|
- name: attempting to remove an non-existant kv from the kv store causes no change
|
|
consul_kv: key=not_present state=absent token='{{test_acl.token}}'
|
|
register: non_existant_key
|
|
|
|
- name: verify removal causes change and existing value is returned
|
|
assert:
|
|
that:
|
|
- non_existant_key.key == 'not_present'
|
|
- non_existant_key.data == None
|
|
- non_existant_key.changed == False
|
|
|
|
- name: Add a key to lookup with the lookup capability
|
|
consul_kv: key='key/to/lookup_{{item}}' value='somevalue_{{item}}' token='{{test_acl.token}}'
|
|
with_items:
|
|
- one
|
|
- two
|
|
register: lookup_keys
|
|
|
|
# necessary to make the new token available to the
|
|
- set_fact: acl_token={{test_acl.token}}
|
|
|
|
- name: kv test
|
|
assert:
|
|
that:
|
|
- "{{ item is match('somevalue_one')}}"
|
|
with_consul_kv:
|
|
- 'key/to/lookup_one token={{acl_token}}'
|
|
|
|
|
|
- name: recursive kv lookup test
|
|
assert:
|
|
that:
|
|
- "{{ item is match('somevalue_(one|two)')}}"
|
|
with_consul_kv:
|
|
- 'key/to recurse=true token={{acl_token}}'
|
|
|
|
- name: remove test acl rule
|
|
consul_acl:
|
|
mgmt_token: '{{mgmt_token}}'
|
|
host: '{{acl_host}}'
|
|
token: '{{test_acl.token}}'
|
|
state: absent
|