@@ -976,20 +976,38 @@ def test_isolation_levels(self):
976
976
con .begin ('Garbage' ).commit ()
977
977
978
978
def test_ports_management (self ):
979
- # check that no ports have been bound yet
980
- assert (len (bound_ports ) == 0 )
979
+ assert bound_ports is not None
980
+ assert type (bound_ports ) == set # noqa: E721
981
+
982
+ if len (bound_ports ) != 0 :
983
+ logging .warning ("bound_ports is not empty: {0}" .format (bound_ports ))
984
+
985
+ stage0__bound_ports = bound_ports .copy ()
981
986
982
987
with __class__ .helper__get_node () as node :
983
- # check that we've just bound a port
984
- assert (len (bound_ports ) == 1 )
988
+ assert bound_ports is not None
989
+ assert type (bound_ports ) == set # noqa: E721
990
+
991
+ assert node .port is not None
992
+ assert type (node .port ) == int # noqa: E721
993
+
994
+ logging .info ("node port is {0}" .format (node .port ))
995
+
996
+ assert node .port in bound_ports
997
+ assert node .port not in stage0__bound_ports
998
+
999
+ assert stage0__bound_ports <= bound_ports
1000
+ assert len (stage0__bound_ports ) + 1 == len (bound_ports )
1001
+
1002
+ stage1__bound_ports = stage0__bound_ports .copy ()
1003
+ stage1__bound_ports .add (node .port )
985
1004
986
- # check that bound_ports contains our port
987
- port_1 = list (bound_ports )[0 ]
988
- port_2 = node .port
989
- assert (port_1 == port_2 )
1005
+ assert stage1__bound_ports == bound_ports
990
1006
991
1007
# check that port has been freed successfully
992
- assert (len (bound_ports ) == 0 )
1008
+ assert bound_ports is not None
1009
+ assert type (bound_ports ) == set # noqa: E721
1010
+ assert bound_ports == stage0__bound_ports
993
1011
994
1012
def test_exceptions (self ):
995
1013
str (StartNodeException ('msg' , [('file' , 'lines' )]))
0 commit comments