Changeset - 5fc2143a00eb
[Not reviewed]
0 3 0
Branko Majic (branko) - 2 months ago 2025-02-02 23:50:34
branko@majic.rs
MAR-243: Drop inventory hostname usage from ldap_server tests:

- Most other roles seem to rely on invoking the hostname command.
- Might be worth it switching to something more technicall correct in
the future, like invoking hostname -f for FQDN.
3 files changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general) First comment
roles/ldap_server/molecule/default/tests/test_default.py
Show inline comments
 
@@ -179,15 +179,15 @@ def test_ldap_tls_private_key_file(host):
 

	
 
    with host.sudo():
 

	
 
        inventory_hostname = host.ansible.get_variables()['inventory_hostname']
 
        hostname = host.run('hostname').stdout.strip()
 

	
 
        key = host.file('/etc/ssl/private/%s_ldap.key' % inventory_hostname)
 
        key = host.file('/etc/ssl/private/%s_ldap.key' % hostname)
 

	
 
        assert key.is_file
 
        assert key.user == 'root'
 
        assert key.group == 'openldap'
 
        assert key.mode == 0o640
 
        assert key.content_string == open('tests/data/x509/server/%s_ldap.key.pem' % inventory_hostname).read()
 
        assert key.content_string == open('tests/data/x509/server/%s_ldap.key.pem' % hostname).read()
 

	
 

	
 
def test_ldap_tls_certificate_file(host):
 
@@ -197,15 +197,15 @@ def test_ldap_tls_certificate_file(host):
 

	
 
    with host.sudo():
 

	
 
        inventory_hostname = host.ansible.get_variables()['inventory_hostname']
 
        hostname = host.run('hostname').stdout.strip()
 

	
 
        cert = host.file('/etc/ssl/certs/%s_ldap.pem' % inventory_hostname)
 
        cert = host.file('/etc/ssl/certs/%s_ldap.pem' % hostname)
 

	
 
        assert cert.is_file
 
        assert cert.user == 'root'
 
        assert cert.group == 'root'
 
        assert cert.mode == 0o644
 
        assert cert.content_string == open('tests/data/x509/server/%s_ldap.cert.pem' % inventory_hostname).read()
 
        assert cert.content_string == open('tests/data/x509/server/%s_ldap.cert.pem' % hostname).read()
 

	
 

	
 
def test_ldap_server_dh_parameter_file(host):
roles/ldap_server/molecule/default/tests/test_mandatory.py
Show inline comments
 
@@ -42,15 +42,15 @@ def test_certificate_validity_check_configuration(host):
 
    correctly.
 
    """
 

	
 
    inventory_hostname = host.ansible.get_variables()['inventory_hostname']
 
    hostname = host.run('hostname').stdout.strip()
 

	
 
    config = host.file('/etc/check_certificate/%s_ldap.conf' % inventory_hostname)
 
    config = host.file('/etc/check_certificate/%s_ldap.conf' % hostname)
 

	
 
    assert config.is_file
 
    assert config.user == 'root'
 
    assert config.group == 'root'
 
    assert config.mode == 0o644
 
    assert config.content_string == "/etc/ssl/certs/%s_ldap.pem" % inventory_hostname
 
    assert config.content_string == "/etc/ssl/certs/%s_ldap.pem" % hostname
 

	
 

	
 
def test_tls_connectivity(host):
roles/ldap_server/molecule/default/tests/test_optional.py
Show inline comments
 
@@ -44,15 +44,15 @@ def test_certificate_validity_check_configuration(host):
 
    correctly.
 
    """
 

	
 
    inventory_hostname = host.ansible.get_variables()['inventory_hostname']
 
    hostname = host.run('hostname').stdout.strip()
 

	
 
    config = host.file('/etc/check_certificate/%s_ldap.conf' % inventory_hostname)
 
    config = host.file('/etc/check_certificate/%s_ldap.conf' % hostname)
 

	
 
    assert config.is_file
 
    assert config.user == 'root'
 
    assert config.group == 'root'
 
    assert config.mode == 0o644
 
    assert config.content_string == "/etc/ssl/certs/%s_ldap.pem" % inventory_hostname
 
    assert config.content_string == "/etc/ssl/certs/%s_ldap.pem" % hostname
 

	
 

	
 
def test_tls_connectivity(host):
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now