Changeset - e8fe43bf880e
[Not reviewed]
0 3 0
Branko Majic (branko) - 2 months ago 2025-01-22 15:00:46
branko@majic.rs
MAR-233: Add IPv6 connectivity tests for the web_server role.
3 files changed with 21 insertions and 2 deletions:
0 comments (0 inline, 0 general) First comment
roles/web_server/molecule/default/molecule.yml
Show inline comments
 
@@ -20,6 +20,11 @@ platforms:
 
        ip: 192.168.56.11
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:11
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
  - name: parameters-mandatory-bookworm
 
    groups:
 
@@ -33,6 +38,11 @@ platforms:
 
        ip: 192.168.56.21
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:21
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
  - name: parameters-optional-bookworm
 
    groups:
 
@@ -46,6 +56,11 @@ platforms:
 
        ip: 192.168.56.22
 
        network_name: private_network
 
        type: static
 
      - auto_config: true
 
        ip: fd00::192:168:56:22
 
        network_name: private_network
 
        netmask: 116
 
        type: static
 

	
 
provisioner:
 
  name: ansible
roles/web_server/molecule/default/prepare.yml
Show inline comments
 
@@ -74,6 +74,9 @@
 
        192.168.56.11: "client"
 
        192.168.56.21: "parameters-mandatory-bookworm"
 
        192.168.56.22: "parameters-optional-bookworm"
 
        fd00::192:168:56:11: "client"
 
        fd00::192:168:56:21: "parameters-mandatory-bookworm"
 
        fd00::192:168:56:22: "parameters-optional-bookworm"
 

	
 
    - name: Install curl for testing redirects and webpage content
 
      ansible.builtin.apt:
roles/web_server/molecule/default/tests/test_client.py
Show inline comments
 
@@ -13,13 +13,14 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
 
    os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('parameters-*')
 
)
 
@pytest.mark.parametrize('port', [80, 443])
 
def test_connectivity(host, server, port):
 
@pytest.mark.parametrize('ip_protocol', [4, 6])
 
def test_connectivity(host, server, port, ip_protocol):
 
    """
 
    Tests connectivity to the web server (ports that should be reachable).
 
    """
 

	
 
    with host.sudo():
 

	
 
        scan = host.run('nmap -4 -p %s -oG - %s', str(port), server)
 
        scan = host.run('nmap -%s -p %s -oG - %s', str(ip_protocol), str(port), server)
 
        assert scan.rc == 0
 
        assert "Ports: %d/open/tcp//" % port in scan.stdout
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now