99 "io"
1010 "net"
1111 "net/netip"
12+ "os"
1213 "strconv"
1314 "sync"
1415 "testing"
@@ -61,7 +62,6 @@ type TestTunnel struct {
6162 HandleUDPPacketFn func (packet C.UDPPacket , metadata * C.Metadata )
6263 NatTableFn func () C.NatTable
6364 CloseFn func () error
64- DoTestFn func (t * testing.T , proxy C.ProxyAdapter )
6565 DoSequentialTestFn func (t * testing.T , proxy C.ProxyAdapter )
6666 DoConcurrentTestFn func (t * testing.T , proxy C.ProxyAdapter )
6767}
@@ -83,7 +83,8 @@ func (tt *TestTunnel) Close() error {
8383}
8484
8585func (tt * TestTunnel ) DoTest (t * testing.T , proxy C.ProxyAdapter ) {
86- tt .DoTestFn (t , proxy )
86+ tt .DoSequentialTestFn (t , proxy )
87+ tt .DoConcurrentTestFn (t , proxy )
8788}
8889
8990func (tt * TestTunnel ) DoSequentialTest (t * testing.T , proxy C.ProxyAdapter ) {
@@ -236,6 +237,9 @@ func NewHttpTestTunnel() *TestTunnel {
236237 concurrentTestFn := func (t * testing.T , proxy C.ProxyAdapter ) {
237238 // Concurrent testing to detect stress
238239 t .Run ("Concurrent" , func (t * testing.T ) {
240+ if skip , _ := strconv .ParseBool (os .Getenv ("SKIP_CONCURRENT_TEST" )); skip {
241+ t .Skip ("skip concurrent test" )
242+ }
239243 wg := sync.WaitGroup {}
240244 num := len (httpData ) / 1024
241245 for i := 1 ; i <= num ; i ++ {
@@ -296,11 +300,7 @@ func NewHttpTestTunnel() *TestTunnel {
296300 }
297301 <- c .ch
298302 },
299- CloseFn : ln .Close ,
300- DoTestFn : func (t * testing.T , proxy C.ProxyAdapter ) {
301- sequentialTestFn (t , proxy )
302- concurrentTestFn (t , proxy )
303- },
303+ CloseFn : ln .Close ,
304304 DoSequentialTestFn : sequentialTestFn ,
305305 DoConcurrentTestFn : concurrentTestFn ,
306306 }
0 commit comments