refactor(netxlite/mocks): group tests, fix naming inconsistencies (#485)

Part of https://github.com/ooni/probe/issues/1591
This commit is contained in:
Simone Basso 2021-09-07 23:12:23 +02:00 committed by GitHub
commit f054ec3201
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 810 additions and 796 deletions

View file

@ -493,7 +493,7 @@ func TestNewSingleUseQUICDialerWorksAsIntended(t *testing.T) {
func TestQUICListenerErrWrapper(t *testing.T) {
t.Run("Listen", func(t *testing.T) {
t.Run("on success", func(t *testing.T) {
expectedConn := &mocks.QUICUDPConn{}
expectedConn := &mocks.QUICUDPLikeConn{}
ql := &quicListenerErrWrapper{
QUICListener: &mocks.QUICListener{
MockListen: func(addr *net.UDPAddr) (quicx.UDPLikeConn, error) {
@ -537,7 +537,7 @@ func TestQUICErrWrapperUDPLikeConn(t *testing.T) {
expectedAddr := &net.UDPAddr{}
p := make([]byte, 128)
conn := &quicErrWrapperUDPLikeConn{
UDPLikeConn: &mocks.QUICUDPConn{
UDPLikeConn: &mocks.QUICUDPLikeConn{
MockReadFrom: func(p []byte) (n int, addr net.Addr, err error) {
return len(p), expectedAddr, nil
},
@ -559,7 +559,7 @@ func TestQUICErrWrapperUDPLikeConn(t *testing.T) {
p := make([]byte, 128)
expectedErr := io.EOF
conn := &quicErrWrapperUDPLikeConn{
UDPLikeConn: &mocks.QUICUDPConn{
UDPLikeConn: &mocks.QUICUDPLikeConn{
MockReadFrom: func(p []byte) (n int, addr net.Addr, err error) {
return 0, nil, expectedErr
},
@ -582,7 +582,7 @@ func TestQUICErrWrapperUDPLikeConn(t *testing.T) {
t.Run("on success", func(t *testing.T) {
p := make([]byte, 128)
conn := &quicErrWrapperUDPLikeConn{
UDPLikeConn: &mocks.QUICUDPConn{
UDPLikeConn: &mocks.QUICUDPLikeConn{
MockWriteTo: func(p []byte, addr net.Addr) (int, error) {
return len(p), nil
},
@ -601,7 +601,7 @@ func TestQUICErrWrapperUDPLikeConn(t *testing.T) {
p := make([]byte, 128)
expectedErr := io.EOF
conn := &quicErrWrapperUDPLikeConn{
UDPLikeConn: &mocks.QUICUDPConn{
UDPLikeConn: &mocks.QUICUDPLikeConn{
MockWriteTo: func(p []byte, addr net.Addr) (int, error) {
return 0, expectedErr
},