@ -602,9 +602,21 @@ func (h Harness) testDistro(t *testing.T, d Distro, ipm ipMapping) {
}
}
defer ln . Close ( )
defer ln . Close ( )
ctx , cancel := context . WithCancel ( context . Background ( ) )
t . Cleanup ( cancel )
go func ( ) {
for {
select {
case <- ctx . Done ( ) :
return
default :
}
sess , err := cli . NewSession ( )
sess , err := cli . NewSession ( )
if err != nil {
if err != nil {
t . Fatalf ( "can't open session: %v" , err )
t . Errorf ( "can't open session: %v" , err )
return
}
}
defer sess . Close ( )
defer sess . Close ( )
@ -615,12 +627,15 @@ func (h Harness) testDistro(t *testing.T, d Distro, ipm ipMapping) {
_ , port , _ := net . SplitHostPort ( ln . LocalAddr ( ) . String ( ) )
_ , port , _ := net . SplitHostPort ( ln . LocalAddr ( ) . String ( ) )
cmd := fmt . Sprintf ( "/udp_tester -client %s\n" , net . JoinHostPort ( "100.64.0.1" , port ) )
cmd := fmt . Sprintf ( "/udp_tester -client %s\n" , net . JoinHostPort ( "100.64.0.1" , port ) )
time . Sleep ( 10 * time . Millisecond )
t . Logf ( "sending packet: %s" , cmd )
t . Logf ( "sending packet: %s" , cmd )
err = sess . Run ( cmd )
err = sess . Run ( cmd )
if err != nil {
if err != nil {
t . Errorf ( "can't send UDP packet: %v" , err )
t . Logf ( "can't send UDP packet: %v" , err )
}
time . Sleep ( 10 * time . Millisecond )
}
}
} ( )
t . Log ( "listening for packet" )
t . Log ( "listening for packet" )
n , _ , err := ln . ReadFromUDP ( buf )
n , _ , err := ln . ReadFromUDP ( buf )