Changeset - d31ae08379b3
[Not reviewed]
0 3 0
Branko Majic (branko) - 2 months ago 2025-01-22 00:11:28
branko@majic.rs
MAR-233: Replace hping3 with nmap in mail_forwarder connectivity tests.
3 files changed with 11 insertions and 10 deletions:
0 comments (0 inline, 0 general) First comment
roles/mail_forwarder/molecule/default/prepare.yml
Show inline comments
 
@@ -80,7 +80,7 @@
 

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

	
 
    - name: Deploy CA certificate
 
@@ -149,7 +149,7 @@
 

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

	
 
    - name: Install SWAKS for testing SMTP capability
roles/mail_forwarder/molecule/default/tests/test_connectivity_from_client.py
Show inline comments
 
@@ -23,6 +23,6 @@ def test_connectivity_from_client(host, server):
 

	
 
    with host.sudo():
 

	
 
        ping = host.run('hping3 -S -p 25 -c 1 %s', server)
 
        assert ping.rc != 0
 
        assert "100% packet loss" in ping.stderr
 
        scan = host.run('nmap -4 -p 25 -oG - %s', server)
 
        assert scan.rc == 0
 
        assert "Ports: 25/filtered/tcp//smtp/" in scan.stdout
roles/mail_forwarder/molecule/default/tests/test_connectivity_from_relay.py
Show inline comments
 
@@ -21,8 +21,9 @@ def test_connectivity_from_authorised_relay(host, server):
 

	
 
    with host.sudo():
 

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

	
 

	
 
@pytest.mark.parametrize("server",
 
@@ -37,9 +38,9 @@ def test_connectivity_from_unauthorised_relay(host, server):
 

	
 
    with host.sudo():
 

	
 
        ping = host.run('hping3 -S -p 25 -c 1 %s', server)
 
        assert ping.rc != 0
 
        assert "100% packet loss" in ping.stderr
 
        scan = host.run('nmap -p 25 -oG - %s', server)
 
        assert scan.rc == 0
 
        assert "Ports: 25/filtered/tcp//smtp/" in scan.stdout
 

	
 

	
 
@pytest.mark.parametrize("server",
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now