Skip to content

Commit 7c98377

Browse files
committed
Refactored P2P test script so I can add more cases
1 parent 33dbb41 commit 7c98377

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

tests/test_p2p.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,35 @@ def StartClientInThread( role, local, remote ):
8585
]
8686
return StartProcessInThread( local, cmdline );
8787

88-
signaling = StartProcessInThread( "signaling", [ './trivial_signaling_server' ] )
88+
# Run a standard client/server connection-oriented case.
89+
# where one peer is the "server" and "listens" and a "client" connects.
90+
def ClientServerTest():
91+
print( "Running basic socket client/server test" )
92+
93+
client1 = StartClientInThread( "server", "peer_server", "peer_client" )
94+
client2 = StartClientInThread( "client", "peer_client", "peer_server" )
8995

90-
client1 = StartClientInThread( "server", "peer_server", "peer_client" )
91-
client2 = StartClientInThread( "client", "peer_client", "peer_server" )
96+
# Wait for clients to shutdown. Nuke them if necessary
97+
client1.join( timeout=20 )
98+
client2.join( timeout=20 )
99+
100+
#
101+
# Main
102+
#
103+
104+
# Start the signaling server
105+
signaling = StartProcessInThread( "signaling", [ './trivial_signaling_server' ] )
92106

93-
# Wait for clients to shutdown. Nuke them if necessary
94-
client1.join( timeout=20 )
95-
client2.join( timeout=20 )
107+
# Run the tests
108+
# FIXME - Add more tests
109+
for test in [ ClientServerTest ]:
110+
print( "=================================================================" )
111+
print( "=================================================================" )
112+
test()
113+
print( "=================================================================" )
114+
print( "=================================================================" )
115+
if g_failed:
116+
break
96117

97118
# Ignore any "failure" detected in signaling server shutdown.
98119
really_failed = g_failed

0 commit comments

Comments
 (0)