File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed
Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -250,6 +250,8 @@ jobs:
250250 # remove old files so we can rerun in-place with "act -r" during test development
251251 rm -vf ~/.ssh/id_dropbear*
252252 ~/inst/bin/dropbearkey -t ecdsa -f ~/.ssh/id_dropbear | grep ^ecdsa > ~/.ssh/authorized_keys
253+ # Convert to openssh format so that asyncssh can find it in tests
254+ ~/inst/bin/dropbearconvert dropbear openssh ~/.ssh/id_dropbear ~/.ssh/id_ecdsa
253255
254256 # to test setting SSH_PUBKEYINFO, replace the trailing comment
255257 ~/inst/bin/dropbearkey -t ecdsa -f ~/.ssh/id_dropbear_key2 | grep ^ecdsa | sed 's/[^ ]*$/key2 extra/' >> ~/.ssh/authorized_keys
Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ psutil==6.0.0
66pyparsing == 2.4.7
77pytest == 8.3.2
88toml == 0.10.2
9+ asyncssh == 2.17.0
Original file line number Diff line number Diff line change 1+ """
2+ Tests opening and closing several (up to 4) channels concurrently.
3+ """
4+ from test_dropbear import *
5+
6+ import asyncssh
7+ import asyncio
8+ import random
9+
10+ async def run (addr , port ):
11+ async with asyncssh .connect (addr , port = port ) as conn :
12+
13+ chans = []
14+ MAX = 4
15+
16+ for x in range (10000 ):
17+ if len (chans ) < MAX :
18+ pipes = await conn .open_session (command = "df" )
19+ chans .append (pipes )
20+ l = len (chans )
21+ print (f" add, len { l } " )
22+
23+ if random .random () < 0.2 :
24+ i = random .randrange (0 , len (chans ))
25+ l = len (chans )
26+ print (f" del { i } /{ l } " )
27+ del chans [i ]
28+
29+ def test_concurrent (request , dropbear ):
30+ opt = request .config .option
31+ host = opt .remote or LOCALADDR
32+ port = int (opt .port )
33+
34+ asyncio .run (run (host , port ))
You can’t perform that action at this time.
0 commit comments