From 0c898f687b2a5385867dc9f71793dd0fb263b9e3 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Sun, 21 Jul 2024 01:58:23 +0300 Subject: [PATCH] Expect I2PController to start in TestProcess._wait_time before checks, thus increasing the maximum wait time, but increase also _connection_limit, because 2 connections it is only the controller and the listener. --- minode/tests/test_process.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/minode/tests/test_process.py b/minode/tests/test_process.py index e6a391c..0cdff39 100644 --- a/minode/tests/test_process.py +++ b/minode/tests/test_process.py @@ -1,11 +1,12 @@ """Blind tests, starting the minode process""" -import unittest +import os import signal import socket import subprocess import sys import tempfile import time +import unittest import psutil @@ -138,12 +139,29 @@ class TestProcess(TestProcessProto): class TestProcessI2P(TestProcess): """Test minode process with --i2p and no IP""" _process_cmd = ['minode', '--i2p', '--no-ip'] - _connection_limit = 4 _listen = True _listening_port = 8448 + @classmethod + def setUpClass(cls): + cls.freezed = False + cls.keyfile = os.path.join(cls.home, 'i2p_dest.pub') + saved = os.path.isfile(cls.keyfile) + super().setUpClass() + for _ in range(cls._wait_time): + if saved: + if cls.process.num_threads() > 3: + break + elif os.path.isfile(cls.keyfile): + break + time.sleep(1) + else: + cls.freezed = True + def test_connections(self): """Ensure all connections are I2P""" + if self.freezed: + self.fail('I2PController has probably failed to start') super().test_connections() for c in self.connections(): self.assertEqual(c.raddr[0], '127.0.0.1')