kytos-ng / kytos-end-to-end-tests

Kytos End-to-End Tests
0 stars 10 forks source link

`test_e2e_06_topology.py::TestE2ETopology::test_025_delete_interface` rerun #305

Closed viniarck closed 3 months ago

viniarck commented 4 months ago

This test case test_e2e_06_topology.py::TestE2ETopology::test_025_delete_interface had reruns on yesterday nightly tests, @Alopalao if you could add this to your radar to eventually fix and enhance this test case, the other tasks your working on atm are higher priority though:

rerun: 0
tests/test_e2e_06_topology.py::TestE2ETopology::test_025_delete_interface: 2024-05-28,04:29:39.073497 - 2024-05-28,04:29:39.295053
self = <tests.test_e2e_06_topology.TestE2ETopology object at 0x7f61baae8b10>

    def test_025_delete_interface(self):
        """Test api/kytos/topology/v3/interfaces/{interface_id} on DELETE
        Deleted:
            - Link: JAX2 - Ampath5
        """
        switch_jax = "00:00:00:00:00:00:00:22"
        switch_a5 = "00:00:00:00:00:00:00:19"
        intf_id = "00:00:00:00:00:00:00:22:15"

        payload = {"flows": [
            {
                "priority": 10,
                "table_id": 1,
                "instructions": [{
                    "instruction_type": "apply_actions",
                    "actions": [{"action_type": "output", "port": 15}]
                }]
            }
        ]}
        api_url = f'{KYTOS_API}/flow_manager/v2/flows/{switch_jax}'
        response = requests.post(api_url, data=json.dumps(payload), headers={'Content-type': 'application/json'})
        assert response.status_code == 202, response.text

        # Interface is enabled
        api_url = f'{KYTOS_API}/topology/v3/interfaces/{intf_id}'
        response = requests.delete(api_url)
        assert response.status_code == 409, response.text

        # Interface is active
        api_url = f'{KYTOS_API}/topology/v3/interfaces/{intf_id}/disable/'
        response = requests.post(api_url)
        assert response.status_code == 200, response.text

        api_url = f'{KYTOS_API}/topology/v3/interfaces/{intf_id}'
        response = requests.delete(api_url)
        assert response.status_code == 409, response.text

        # Interface has a link
        JAX2 = self.net.net.get('JAX2')
        JAX2.detach('JAX2-eth15')

        api_url = f'{KYTOS_API}/topology/v3/interfaces/{intf_id}'
        response = requests.delete(api_url)
        assert response.status_code == 409, response.text

        # Installed flows related to the interface
        api_url = f'{KYTOS_API}/topology/v3/links'
        response = requests.get(api_url)
        assert response.status_code == 200
        data = response.json()
        link_id = None
        for key, value in data['links'].items():
            endpoint_a = value["endpoint_a"]["switch"]
            endpoint_b = value["endpoint_b"]["switch"]
            if ((endpoint_a == switch_jax and endpoint_b == switch_a5) or
                (endpoint_b == switch_jax and endpoint_a == switch_a5)):
                link_id = key
                break
>       assert link_id
E       assert None

tests/test_e2e_06_topology.py:214: AssertionError
rerun: 1
tests/test_e2e_06_topology.py::TestE2ETopology::test_025_delete_interface: 2024-05-28,04:30:02.429030 - 2024-05-28,04:30:02.560505
self = <tests.test_e2e_06_topology.TestE2ETopology object at 0x7f61baae8b10>

    def test_025_delete_interface(self):
        """Test api/kytos/topology/v3/interfaces/{interface_id} on DELETE
        Deleted:
            - Link: JAX2 - Ampath5
        """
        switch_jax = "00:00:00:00:00:00:00:22"
        switch_a5 = "00:00:00:00:00:00:00:19"
        intf_id = "00:00:00:00:00:00:00:22:15"

        payload = {"flows": [
            {
                "priority": 10,
                "table_id": 1,
                "instructions": [{
                    "instruction_type": "apply_actions",
                    "actions": [{"action_type": "output", "port": 15}]
                }]
            }
        ]}
        api_url = f'{KYTOS_API}/flow_manager/v2/flows/{switch_jax}'
        response = requests.post(api_url, data=json.dumps(payload), headers={'Content-type': 'application/json'})
        assert response.status_code == 202, response.text

        # Interface is enabled
        api_url = f'{KYTOS_API}/topology/v3/interfaces/{intf_id}'
        response = requests.delete(api_url)
>       assert response.status_code == 409, response.text
E       AssertionError: {"description":"Interface not found.","code":404}
E       assert 404 == 409
E        +  where 404 = <Response [404]>.status_code

tests/test_e2e_06_topology.py:182: AssertionError
tests/test_e2e_06_topology.py::TestE2ETopology::test_025_delete_interface: 2024-05-28,04:30:27.312145 - 2024-05-28,04:30:27.411209
=========================== rerun test summary info ============================
RERUN tests/test_e2e_06_topology.py::TestE2ETopology::test_025_delete_interface
RERUN tests/test_e2e_06_topology.py::TestE2ETopology::test_025_delete_interface
=========================== short test summary info ============================
FAILED tests/test_e2e_06_topology.py::TestE2ETopology::test_025_delete_interface - AssertionError: {"description":"Interface not found.","code":404}
assert 404 == 409
 +  where 404 = <Response [404]>.status_code
= 1 failed, 238 passed, 8 skipped, 9 xfailed, 7 xpassed, 1295 warnings, 2 rerun in 12289.74s (3:24:49) =
section_end:1716881495:step_script
section_start:1716881495:cleanup_file_variables
Cleaning up file based variables
Alopalao commented 4 months ago

In the second test try the interface was not found. This means that the interface was deleted automatically in the first test try. Meaning the link was non existent since the beginning of the test. This is really strange.