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.
This commit is contained in:
Lee Miller 2024-07-21 01:58:23 +03:00
parent 97576f6750
commit 0c898f687b
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -1,11 +1,12 @@
"""Blind tests, starting the minode process""" """Blind tests, starting the minode process"""
import unittest import os
import signal import signal
import socket import socket
import subprocess import subprocess
import sys import sys
import tempfile import tempfile
import time import time
import unittest
import psutil import psutil
@ -138,12 +139,29 @@ class TestProcess(TestProcessProto):
class TestProcessI2P(TestProcess): class TestProcessI2P(TestProcess):
"""Test minode process with --i2p and no IP""" """Test minode process with --i2p and no IP"""
_process_cmd = ['minode', '--i2p', '--no-ip'] _process_cmd = ['minode', '--i2p', '--no-ip']
_connection_limit = 4
_listen = True _listen = True
_listening_port = 8448 _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): def test_connections(self):
"""Ensure all connections are I2P""" """Ensure all connections are I2P"""
if self.freezed:
self.fail('I2PController has probably failed to start')
super().test_connections() super().test_connections()
for c in self.connections(): for c in self.connections():
self.assertEqual(c.raddr[0], '127.0.0.1') self.assertEqual(c.raddr[0], '127.0.0.1')