Skip to content

Commit df8df52

Browse files
tests/test_remote: add test_exporter_start_coordinator_unreachable
Previously the exporter had blocking issues when the coordinator was not available. Add a test to prevent future regressions. Signed-off-by: Bastian Krause <[email protected]>
1 parent 5b2776d commit df8df52

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_remote.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,23 @@ def test_exporter_help():
1515
spawn.close()
1616
assert spawn.exitstatus == 0
1717
assert spawn.signalstatus is None
18+
19+
def test_exporter_start_coordinator_unreachable(monkeypatch, tmpdir):
20+
monkeypatch.setenv("LG_COORDINATOR", "coordinator.invalid")
21+
22+
config = "exports.yaml"
23+
p = tmpdir.join(config)
24+
p.write(
25+
"""
26+
Testport:
27+
NetworkSerialPort:
28+
host: 'localhost'
29+
port: 4000
30+
"""
31+
)
32+
33+
with pexpect.spawn(f"python -m labgrid.remote.exporter {config}", cwd=tmpdir) as spawn:
34+
spawn.expect("coordinator is unavailable", timeout=10)
35+
spawn.expect(pexpect.EOF)
36+
spawn.close()
37+
assert spawn.exitstatus == 100, spawn.before

0 commit comments

Comments
 (0)