Improve changed / nonchanged validations by using new modules from community.internal_test_tools (#183)
* Use modules from internal_test_tools instead of stat workaround to check whether file actually changed. * Properly add testing dependency.pull/364/head
parent
2c05221d89
commit
471506c5d4
|
@ -299,11 +299,18 @@
|
|||
size: '{{ default_rsa_key_size }}'
|
||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||
register: privatekey_mode_1
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Stat for privatekey_mode"
|
||||
stat:
|
||||
path: '{{ remote_tmp_dir }}/privatekey_mode.pem'
|
||||
register: privatekey_mode_1_stat
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Collect file information"
|
||||
community.internal_test_tools.files_collect:
|
||||
files:
|
||||
- path: '{{ remote_tmp_dir }}/privatekey_mode.pem'
|
||||
register: privatekey_mode_1_fileinfo
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Generate privatekey_mode (mode 0400, idempotency)"
|
||||
openssl_privatekey:
|
||||
path: '{{ remote_tmp_dir }}/privatekey_mode.pem'
|
||||
|
@ -312,13 +319,6 @@
|
|||
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||
register: privatekey_mode_2
|
||||
|
||||
- name: Make sure that mtime actually changes.
|
||||
# The "privatekey_mode_1_stat.stat.mtime != privatekey_mode_3_stat.stat.mtime" test should be
|
||||
# changed to compare content instead of mtime. On macOS 10.15, mtime resolution is one second,
|
||||
# and the machine (VM) is fast enough that both modifications can happen in the same second.
|
||||
pause:
|
||||
seconds: 1
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Generate privatekey_mode (mode 0400, force)"
|
||||
openssl_privatekey:
|
||||
path: '{{ remote_tmp_dir }}/privatekey_mode.pem'
|
||||
|
@ -327,11 +327,17 @@
|
|||
size: '{{ default_rsa_key_size }}'
|
||||
select_crypto_backend: '{{ select_crypto_backend }}'
|
||||
register: privatekey_mode_3
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Stat for privatekey_mode"
|
||||
stat:
|
||||
path: '{{ remote_tmp_dir }}/privatekey_mode.pem'
|
||||
register: privatekey_mode_3_stat
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Make sure that file changed"
|
||||
community.internal_test_tools.files_diff:
|
||||
state: '{{ privatekey_mode_1_fileinfo }}'
|
||||
register: privatekey_mode_3_file_change
|
||||
|
||||
- block:
|
||||
- name: "({{ select_crypto_backend }}) Generate privatekey_fmt_1 - auto format"
|
||||
openssl_privatekey:
|
||||
|
|
|
@ -186,7 +186,7 @@
|
|||
- privatekey_mode_2 is not changed
|
||||
- privatekey_mode_3 is changed
|
||||
- privatekey_mode_3_stat.stat.mode == '0400'
|
||||
- privatekey_mode_1_stat.stat.mtime != privatekey_mode_3_stat.stat.mtime
|
||||
- privatekey_mode_3_file_change is changed
|
||||
|
||||
- name: "({{ select_crypto_backend }}) Validate format 1"
|
||||
assert:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
integration_tests_dependencies:
|
||||
- community.general
|
||||
- community.internal_test_tools
|
||||
unit_tests_dependencies: []
|
||||
|
|
|
@ -89,7 +89,7 @@ if [ "${test}" == "sanity/extra" ]; then
|
|||
fi
|
||||
|
||||
# START: HACK install integration test dependencies
|
||||
if [ "${test}" == "sanity/extra" ]; then
|
||||
if [ "${script}" != "units" ] && [ "${script}" != "sanity" ] || [ "${test}" == "sanity/extra" ]; then
|
||||
# Nothing further should be added to this list.
|
||||
# This is to prevent modules or plugins in this collection having a runtime dependency on other collections.
|
||||
retry git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git "${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/community/internal_test_tools"
|
||||
|
|
Loading…
Reference in New Issue