Skip to content

Commit

Permalink
add close cnt assertion in udp_test
Browse files Browse the repository at this point in the history
  • Loading branch information
jyyi1 committed Jul 25, 2023
1 parent 09d310e commit b16855a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions network/lwip2transport/udp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package lwip2transport

import (
"errors"
"fmt"
"net"
"net/netip"
"testing"
Expand All @@ -40,11 +39,13 @@ func TestUDPResponseWriterClose(t *testing.T) {
// udpHandler must make sure only one `Close()` is called, and there should be no deadlocks
err = proxy.Close()
require.NoError(t, err)
require.Exactly(t, 1, proxy.closeCnt)
}

/********** Test Utilities **********/

type noopSingleSessionPacketProxy struct {
closeCnt int
respWriter network.PacketResponseReceiver
}

Expand All @@ -57,7 +58,7 @@ func (p *noopSingleSessionPacketProxy) NewSession(respWriter network.PacketRespo
}

func (p *noopSingleSessionPacketProxy) Close() error {
fmt.Println("Closing !!!!!")
p.closeCnt++
return p.respWriter.Close()
}

Expand Down

0 comments on commit b16855a

Please sign in to comment.