Skip to content

Commit 2d0360f

Browse files
authored
Merge pull request #9 from SmithChart/less-flaky
Overhaul falky tests
2 parents 51d9128 + 39d246e commit 2d0360f

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ The minimum resources needed to control an LXA TAC DUT are:
5151
- **HTTPProvider**: An HTTP-Server that can be used by labgrid to serve images to the DUT.
5252
Used to test streaming updates using RAUC.
5353

54+
Optionally the following resource should be attached:
55+
56+
- **USB Mass Storage**: The test `test_labgrid_resources_usb` assumes that a USB mass storage
57+
device is connected to one of the host ports.
58+
5459
The labgrid environments provided here are the ones used during development and thus contain settings specific to our
5560
lab.
5661
However, the `lxatac-vanialla.yml` is a good starting point to configure your own environment.

agents/lxatac-eet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def connect(self, spec="", ignore_exclusive=False):
210210
raise ValueError(f"Last path element {path[-1]} must be a leave")
211211

212212
if any(p not in self.NON_LEAVES for p in path[1:-1]):
213-
raise ValueError(f'All in-between path elements ({" -> ".join(path[1:-1])}) must be non-leaves')
213+
raise ValueError(f"All in-between path elements ({' -> '.join(path[1:-1])}) must be non-leaves")
214214

215215
prev_node = path[0]
216216

tests/test_network.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ def test_network_tftp(prepare_network, shell):
5454
assert len(checksum1) > 0
5555

5656
# Upload file to tftp server
57-
shell.run_check("ip netns exec dut-namespace tftp -p -r ./test_file 10.11.12.2")
57+
shell.run_check("ip netns exec dut-namespace tftp -p -r ./test_file 10.11.12.2", timeout=35)
5858

5959
# Download file from tftp server
60-
shell.run_check("ip netns exec dut-namespace tftp -g -r test_file 10.11.12.2")
60+
shell.run_check("ip netns exec dut-namespace tftp -g -r test_file 10.11.12.2", timeout=35)
6161

6262
# Generate checksum
6363
checksum2 = shell.run_check("md5sum ./test_file")

tests/test_tacd.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,29 +298,34 @@ def test_tacd_dut_power_off_floating(strategy, shell, eet):
298298

299299
# Connect 5V via 1K Ohm to PWR_OUT
300300
eet.link("5V_1K -> 5V -> BUS1 -> VOLT, PWR_OUT -> BUS2 -> VOLT")
301-
time.sleep(0.2) # Give measurements a moment to settle
301+
time.sleep(0.5) # Give measurements a moment to settle
302302

303303
# measure DUT voltage
304304
r = requests.get(f"http://{strategy.network.address}/v1/dut/feedback/voltage")
305305
assert r.status_code == 200
306306
off_voltage = r.json()["value"]
307-
assert 3 < off_voltage < 5.5 # USB supply voltage can be all over the place
307+
308+
# USB supply voltage can be all over the place
309+
assert 3 < off_voltage < 5.5, "Off-voltage is not inside USB-Supply range"
308310

309311
# Switch power switch to off without the load.
310312
r = requests.put(f"http://{strategy.network.address}/v1/dut/powered", data=b'"OffFloating"')
311313
assert r.status_code == 204
312-
time.sleep(0.2) # Give measurements a moment to settle
314+
time.sleep(0.5) # Give measurements a moment to settle
313315

314316
# measure DUT voltage
315317
r = requests.get(f"http://{strategy.network.address}/v1/dut/feedback/voltage")
316318
assert r.status_code == 200
317319
floating_voltage = r.json()["value"]
318-
assert 3 < floating_voltage < 5.5 # USB supply voltage can be all over the place
319320

320-
assert floating_voltage > off_voltage
321+
# USB supply voltage can be all over the place
322+
assert 3 < floating_voltage < 5.5, "OffFloating-voltage is not inside USB-supply range"
323+
324+
# Make sure both measurements have the right relation
325+
assert floating_voltage > off_voltage, "OffFloating-voltage is not higher than Off-voltage"
321326

322327
# Voltage relation is given by the voltage divider of 1k and 10k
323-
assert off_voltage / floating_voltage == pytest.approx(10e3 / (10e3 + 1e3), rel=0.1)
328+
assert off_voltage / floating_voltage == pytest.approx(10e3 / (10e3 + 1e3), rel=0.15)
324329

325330

326331
@pytest.mark.lg_feature("eet")

0 commit comments

Comments
 (0)