mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 13:23:01 +02:00
test: infamy: Add a timeout when starting each test if the DUTs is not reachable
This to cover if you run one test, but the DUTs are still booting.
This commit is contained in:
+12
-1
@@ -6,7 +6,7 @@ import sys
|
||||
import random
|
||||
import inspect
|
||||
|
||||
from . import neigh, netconf, restconf, ssh, tap, topology
|
||||
from . import neigh, netconf, restconf, ssh, tap, topology, util
|
||||
|
||||
|
||||
class NullEnv:
|
||||
@@ -116,6 +116,13 @@ class Env(object):
|
||||
def get_password(self, node):
|
||||
return self.ptop.get_password(node)
|
||||
|
||||
def is_reachable(self, node, port):
|
||||
ip = neigh.ll6ping(port)
|
||||
if not ip:
|
||||
return False
|
||||
|
||||
return util.is_reachable(ip, self, self.get_password(node))
|
||||
|
||||
def attach(self, node, port="mgmt", protocol=None, test_reset=True, username = None, password = None):
|
||||
"""Attach to node on port using protocol."""
|
||||
|
||||
@@ -126,6 +133,7 @@ class Env(object):
|
||||
else:
|
||||
mapping = None
|
||||
|
||||
|
||||
# Precedence:
|
||||
# 1. Caller specifies `protocol`
|
||||
# 2. User specifies `-t` when executing test
|
||||
@@ -141,6 +149,9 @@ class Env(object):
|
||||
ctrl = self.ptop.get_ctrl()
|
||||
cport, _ = self.ptop.get_mgmt_link(ctrl, node)
|
||||
|
||||
print("Waiting for DUTs to become reachable...")
|
||||
util.parallel(util.until(lambda: self.is_reachable(node, cport), 300))
|
||||
|
||||
print(f"Probing {node} on port {cport} for IPv6LL mgmt address ...")
|
||||
mgmtip = neigh.ll6ping(cport)
|
||||
if not mgmtip:
|
||||
|
||||
Reference in New Issue
Block a user