Fix incorrect assumptions in integration tests. (#58372)
* Fix service integration test. Set the proper file mode when copying before asserting the mode is correct. * Fix certificate_complete_chain test. Do not assume that testhost is the same as localhost.
This commit is contained in:
parent
46214c9ef4
commit
5e4f457a47
3 changed files with 26 additions and 9 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
dependencies:
|
||||||
|
- setup_remote_tmp_dir
|
|
@ -4,12 +4,27 @@
|
||||||
register: cryptography_version
|
register: cryptography_version
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
|
- name: Archive test files
|
||||||
|
archive:
|
||||||
|
path: "{{ role_path }}/files/"
|
||||||
|
dest: "{{ output_dir }}/files.tgz"
|
||||||
|
|
||||||
|
- name: Create temporary directory to store files
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "{{ remote_tmp_dir }}/files/"
|
||||||
|
|
||||||
|
- name: Unarchive test files on testhost
|
||||||
|
unarchive:
|
||||||
|
src: "{{ output_dir }}/files.tgz"
|
||||||
|
dest: "{{ remote_tmp_dir }}/files/"
|
||||||
|
|
||||||
# Cert 1: certificate for www.ansible.com, retrieved on 2018-08-15
|
# Cert 1: certificate for www.ansible.com, retrieved on 2018-08-15
|
||||||
- name: Find root for cert 1
|
- name: Find root for cert 1
|
||||||
certificate_complete_chain:
|
certificate_complete_chain:
|
||||||
input_chain: "{{ lookup('file', 'cert1-fullchain.pem', rstrip=False) }}"
|
input_chain: "{{ lookup('file', 'cert1-fullchain.pem', rstrip=False) }}"
|
||||||
root_certificates:
|
root_certificates:
|
||||||
- "{{ role_path }}/files/roots/"
|
- "{{ remote_tmp_dir }}/files/roots/"
|
||||||
register: cert1_root
|
register: cert1_root
|
||||||
- name: Verify root for cert 1
|
- name: Verify root for cert 1
|
||||||
assert:
|
assert:
|
||||||
|
@ -21,9 +36,9 @@
|
||||||
certificate_complete_chain:
|
certificate_complete_chain:
|
||||||
input_chain: "{{ lookup('file', 'cert1.pem', rstrip=False) }}"
|
input_chain: "{{ lookup('file', 'cert1.pem', rstrip=False) }}"
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- "{{ role_path }}/files/cert1-chain.pem"
|
- "{{ remote_tmp_dir }}/files/cert1-chain.pem"
|
||||||
root_certificates:
|
root_certificates:
|
||||||
- "{{ role_path }}/files/roots.pem"
|
- "{{ remote_tmp_dir }}/files/roots.pem"
|
||||||
register: cert1_rootchain
|
register: cert1_rootchain
|
||||||
- name: Verify rootchain for cert 1
|
- name: Verify rootchain for cert 1
|
||||||
assert:
|
assert:
|
||||||
|
@ -38,7 +53,7 @@
|
||||||
certificate_complete_chain:
|
certificate_complete_chain:
|
||||||
input_chain: "{{ lookup('file', 'cert2-fullchain.pem', rstrip=False) }}"
|
input_chain: "{{ lookup('file', 'cert2-fullchain.pem', rstrip=False) }}"
|
||||||
root_certificates:
|
root_certificates:
|
||||||
- "{{ role_path }}/files/roots/"
|
- "{{ remote_tmp_dir }}/files/roots/"
|
||||||
register: cert2_root
|
register: cert2_root
|
||||||
- name: Verify root for cert 2
|
- name: Verify root for cert 2
|
||||||
assert:
|
assert:
|
||||||
|
@ -50,9 +65,9 @@
|
||||||
certificate_complete_chain:
|
certificate_complete_chain:
|
||||||
input_chain: "{{ lookup('file', 'cert2.pem', rstrip=False) }}"
|
input_chain: "{{ lookup('file', 'cert2.pem', rstrip=False) }}"
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- "{{ role_path }}/files/cert2-chain.pem"
|
- "{{ remote_tmp_dir }}/files/cert2-chain.pem"
|
||||||
root_certificates:
|
root_certificates:
|
||||||
- "{{ role_path }}/files/roots.pem"
|
- "{{ remote_tmp_dir }}/files/roots.pem"
|
||||||
register: cert2_rootchain
|
register: cert2_rootchain
|
||||||
- name: Verify rootchain for cert 2
|
- name: Verify rootchain for cert 2
|
||||||
assert:
|
assert:
|
||||||
|
@ -68,9 +83,9 @@
|
||||||
# Remove line ending, make sure it is re-added by code
|
# Remove line ending, make sure it is re-added by code
|
||||||
input_chain: "{{ lookup('file', 'cert2.pem', rstrip=True) }}"
|
input_chain: "{{ lookup('file', 'cert2.pem', rstrip=True) }}"
|
||||||
intermediate_certificates:
|
intermediate_certificates:
|
||||||
- "{{ role_path }}/files/cert2-altchain.pem"
|
- "{{ remote_tmp_dir }}/files/cert2-altchain.pem"
|
||||||
root_certificates:
|
root_certificates:
|
||||||
- "{{ role_path }}/files/roots.pem"
|
- "{{ remote_tmp_dir }}/files/roots.pem"
|
||||||
register: cert2_rootchain_alt
|
register: cert2_rootchain_alt
|
||||||
- name: Verify rootchain for cert 2
|
- name: Verify rootchain for cert 2
|
||||||
assert:
|
assert:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
- name: install the systemd unit file
|
- name: install the systemd unit file
|
||||||
copy: src=ansible.systemd dest=/etc/systemd/system/ansible_test.service
|
copy: src=ansible.systemd dest=/etc/systemd/system/ansible_test.service mode=0644
|
||||||
register: install_systemd_result
|
register: install_systemd_result
|
||||||
|
|
||||||
- name: install a broken systemd unit file
|
- name: install a broken systemd unit file
|
||||||
|
|
Loading…
Reference in a new issue