mirror of
https://github.com/clearml/dropbear
synced 2025-06-26 18:17:32 +00:00
sync_git_2024.86 tag/DROPBEAR_2024.86
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
attrs==21.2.0
|
||||
iniconfig==1.1.1
|
||||
packaging==21.0
|
||||
pluggy==1.0.0
|
||||
py==1.10.0
|
||||
iniconfig==2.0.0
|
||||
packaging==24.1
|
||||
pluggy==1.5.0
|
||||
psutil==6.0.0
|
||||
pyparsing==2.4.7
|
||||
pytest==6.2.5
|
||||
pytest==8.3.2
|
||||
toml==0.10.2
|
||||
psutil==5.9.0
|
||||
asyncssh==2.17.0
|
||||
|
||||
@@ -69,9 +69,9 @@ def test_bg_sleep(request, fd, dropbear):
|
||||
|
||||
|
||||
def test_idle(request, dropbear):
|
||||
# Idle test, -I 1 should make it return before the 2 second timeout
|
||||
# Idle test, -I 1 should make it return before the 5 second timeout
|
||||
r = dbclient(request, "-I", "1", "echo zong; sleep 10",
|
||||
capture_output=True, timeout=2, text=True)
|
||||
capture_output=True, timeout=5, text=True)
|
||||
r.check_returncode()
|
||||
assert r.stdout.rstrip() == "zong"
|
||||
|
||||
|
||||
34
test/test_concurrent.py
Normal file
34
test/test_concurrent.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""
|
||||
Tests opening and closing several (up to 4) channels concurrently.
|
||||
"""
|
||||
from test_dropbear import *
|
||||
|
||||
import asyncssh
|
||||
import asyncio
|
||||
import random
|
||||
|
||||
async def run(addr, port):
|
||||
async with asyncssh.connect(addr, port = port) as conn:
|
||||
|
||||
chans = []
|
||||
MAX=4
|
||||
|
||||
for x in range(10000):
|
||||
if len(chans) < MAX:
|
||||
pipes = await conn.open_session(command = "df")
|
||||
chans.append(pipes)
|
||||
l = len(chans)
|
||||
print(f" add, len {l}")
|
||||
|
||||
if random.random() < 0.2:
|
||||
i = random.randrange(0, len(chans))
|
||||
l = len(chans)
|
||||
print(f" del {i}/{l}")
|
||||
del chans[i]
|
||||
|
||||
def test_concurrent(request, dropbear):
|
||||
opt = request.config.option
|
||||
host = opt.remote or LOCALADDR
|
||||
port = int(opt.port)
|
||||
|
||||
asyncio.run(run(host, port))
|
||||
Reference in New Issue
Block a user