From 64fb1c655a1434b13e7ab6a9c604b3e5291fd43d Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Wed, 17 Jul 2024 16:24:56 +0200 Subject: [PATCH] tests/test_remote: add test_exporter_coordinator_becomes_unreachable A previous commit added a test for exporter startup with an unreachable coordinator. Now also add a test simulating a dissappearing coordinator during operation. The exporter should notice the coordinator disappearing and should exit with exitcode 100. This way systemd can try restarting the exporter regularly until the coordinator is available again. Signed-off-by: Bastian Krause --- tests/test_remote.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_remote.py b/tests/test_remote.py index b07b5b170..ca09908ec 100644 --- a/tests/test_remote.py +++ b/tests/test_remote.py @@ -35,3 +35,12 @@ def test_exporter_start_coordinator_unreachable(monkeypatch, tmpdir): spawn.expect(pexpect.EOF) spawn.close() assert spawn.exitstatus == 100, spawn.before + +def test_exporter_coordinator_becomes_unreachable(coordinator, exporter): + coordinator.suspend_tree() + + exporter.spawn.expect(pexpect.EOF, timeout=30) + exporter.spawn.close() + assert exporter.exitstatus == 100 + + coordinator.resume_tree()