system_tests pipeline step fails sporadically
Failures seem to happen more on CentOS 7 e.g.:
https://gitlab.isc.org/isc-projects/stork/-/jobs/1766303
=================================== FAILURES ===================================
____________ test_add_kea_with_many_subnets[ubuntu/18.04-centos/7] _____________
agent =
server =
@pytest.mark.parametrize("agent, server", [('ubuntu/18.04', 'centos/7')])
def test_add_kea_with_many_subnets(agent, server):
"""Check if Stork agent and server will handle Kea instance with huge amount of subnets."""
# install kea on the agent machine
agent.install_kea()
# prepare kea config with many subnets and upload it to the agent
banner("UPLOAD KEA CONFIG WITH MANY SUBNETS")
subprocess.run('../../docker/gen-kea-config.py 7000 > kea-dhcp4-many-subnets.conf', shell=True, check=True)
agent.upload('kea-dhcp4-many-subnets.conf', '/etc/kea/kea-dhcp4.conf')
subprocess.run('rm -f kea-dhcp4-many-subnets.conf', shell=True)
agent.run('systemctl restart isc-kea-dhcp4-server')
# login
r = server.api_post('/sessions', json=dict(useremail='admin', userpassword='admin'), expected_status=200) # TODO: POST should return 201
assert r.json()['login'] == 'admin'
# get machine that automatically registered in the server and authorize it
m = _get_machines_and_authorize_them(server)[0]
assert m['address'] == agent.mgmt_ip
# check machine state
m = _get_machine_state(server, m['id'])
agent = <containers.StorkAgentContainer object at 0x7fa4ba2ed2e0>
m = {'address': '10.69.61.157', 'agentPort': 8080, 'agentToken': 'B3C1E6D585543268F34BD2B67762DAF0C85FCC88229746C49B8DEA0573D90568', 'agentVersion': '0.18.0', ...}
r = <Response [200]>
server = <containers.StorkServerContainer object at 0x7fa4b81b2eb0>
tests.py:217:
server = <containers.StorkServerContainer object at 0x7fa4b81b2eb0>, m_id = 1
def _get_machine_state(server, m_id):
for i in range(100):
r = server.api_get('/machines/%d/state' % m_id)
data = {'address': '10.69.61.157', 'agentPort': 8080, 'agentToken': 'B3C1E6D585543268F34BD2B67762DAF0C85FCC88229746C49B8DEA0573D90568', 'agentVersion': '0.18.0', ...}
i = 3
m_id = 1
r = <Response [200]>
server = <containers.StorkServerContainer object at 0x7fa4b81b2eb0>
tests.py:59:
self = <containers.StorkServerContainer object at 0x7fa4b81b2eb0>
endpoint = '/machines/1/state', params = None, expected_status = 200
trace_resp = True
def api_get(self, endpoint, params=None, expected_status=200, trace_resp=True):
url = 'http://localhost:%d/api' % self.port
url += endpoint
print('r.get', url, params)
r = self.session.get(url, params=params)
print('r.status_code', r.status_code)
if trace_resp:
print('r.text', r.text)
assert r.status_code == expected_status
E AssertionError
endpoint = '/machines/1/state'
expected_status = 200
params = None
r = <Response [500]>
self = <containers.StorkServerContainer object at 0x7fa4b81b2eb0>
trace_resp = True
url = 'http://localhost:33950/api/machines/1/state'
containers.py:434: AssertionError
, but I think there were some on an Ubuntu as well.
The allow_failures: true
should be removed after this is fixed.