Changeset - e84ee30194a1
[Not reviewed]
0 2 0
Branko Majic (branko) - 10 months ago 2025-01-22 02:20:27
branko@majic.rs
MAR-233: Replace hping3 with nmap in connectivity tests for mail_server role.
2 files changed with 3 insertions and 7 deletions:
0 comments (0 inline, 0 general)
roles/mail_server/molecule/default/prepare.yml
Show inline comments
 
@@ -253,17 +253,12 @@
 

	
 
    - name: Install tool for testing SIEVE
 
      ansible.builtin.apt:
 
        name: sieve-connect
 
        state: present
 

	
 
    - name: Install tool for testing TCP connectivity
 
      ansible.builtin.apt:
 
        name: hping3
 
        state: present
 

	
 
    - name: Deploy IMAP CLI configuration
 
      ansible.builtin.copy:
 
        src: "tests/data/{{ item }}"
 
        dest: "/home/vagrant/{{ item }}"
 
        owner: vagrant
 
        group: vagrant
roles/mail_server/molecule/default/tests/test_client2.py
Show inline comments
 
@@ -291,14 +291,15 @@ def test_sieve_authentication_requires_tls(host):
 
def test_connectivity(host, server, port):
 
    """
 
    Tests connectivity to the mail server (ports that should be reachable).
 
    """
 

	
 
    with host.sudo():
 
        ping = host.run('hping3 -S -p %s -c 1 %s', str(port), server)
 
        assert ping.rc == 0
 
        scan = host.run('nmap -4 -p %s -oG - %s', str(port), server)
 
        assert scan.rc == 0
 
        assert "Ports: %d/open/tcp//" % port in scan.stdout
 

	
 

	
 
def test_port_forwarding(host):
 
    """
 
    Tests if port forwarding is set-up correctly for additional SMTP and
 
    submission ports.
0 comments (0 inline, 0 general)