Skip to content

Commit

Permalink
testutils/iotlab.py: Randomize the selected node
Browse files Browse the repository at this point in the history
It seems there have been some failures mainly
due to infrastructure. Specifically the samr21-xpro
failing to flash will cause many reruns with the same
faulty hardware.

Previously it would just take the first available
node in the list, which is deterministic but doesn't
help with flakey test reruns. This may cause an issue
with distance to other nodes, but if random selection
of nodes becomes a problem we would have to introduce
node pairing lists... Which is a bit more work.

This is at least a first step.
  • Loading branch information
MrKevinWeiss committed Jan 29, 2024
1 parent 0c23dbb commit 9588fab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions testutils/iotlab.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import random
import re

from iotlabcli.auth import get_user_credentials
Expand Down Expand Up @@ -55,14 +56,14 @@ def __init__(self, name, ctrls, site=DEFAULT_SITE):
def board_from_iotlab_node(iotlab_node):
"""Return BOARD matching iotlab_node"""
reg = r'([0-9a-zA-Z\-]+)-\d+\.[a-z]+\.iot-lab\.info'
match = re.search(reg, iotlab_node)
if match is None:
matches = re.findall(reg, iotlab_node)
if not matches:
raise ValueError(
f"Unable to parse {iotlab_node} as IoT-LAB node "
"name of format "
"<node-name>.<site-name>.iot-lab.info"
)
iotlab_node_name = match.group(1)
iotlab_node_name = random.choice(matches)
dict_values = IoTLABExperiment.BOARD_ARCHI_MAP.values()
dict_names = [value['name'] for value in dict_values]
dict_keys = list(IoTLABExperiment.BOARD_ARCHI_MAP.keys())
Expand Down

0 comments on commit 9588fab

Please sign in to comment.