removed some old debugging output
This commit is contained in:
parent
8fe79e3c38
commit
74b7b7d5e1
2
Makefile
2
Makefile
@ -14,7 +14,7 @@ vet: fmt
|
|||||||
go vet ./...
|
go vet ./...
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
go test -count=1 ./...
|
go test -count=1 ${TESTFLAGS} ./...
|
||||||
|
|
||||||
build: generate vet
|
build: generate vet
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
|
@ -12,7 +12,6 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
"go.uber.org/goleak"
|
"go.uber.org/goleak"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
@ -272,7 +271,6 @@ func (s *AdminTestSuite) connectClientToAgent(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Got agentToServerYamux")
|
|
||||||
serverToAgentYamux := clientConn.agentConnection
|
serverToAgentYamux := clientConn.agentConnection
|
||||||
|
|
||||||
// Now first test the communication from server to agent over the just established connection
|
// Now first test the communication from server to agent over the just established connection
|
||||||
@ -361,9 +359,7 @@ func (s *AdminTestSuite) connectClient(publicId string, serverToClientRW io.Read
|
|||||||
|
|
||||||
func (s *AdminTestSuite) clientConnection(clientId models.ClientId, listener *testsupport.TestAgentListener) (net.Conn, error) {
|
func (s *AdminTestSuite) clientConnection(clientId models.ClientId, listener *testsupport.TestAgentListener) (net.Conn, error) {
|
||||||
// agent
|
// agent
|
||||||
log.Printf("clientConnection: Getting connection for %v", clientId)
|
|
||||||
agentToServerYamux, err := listener.GetConnection(string(clientId))
|
agentToServerYamux, err := listener.GetConnection(string(clientId))
|
||||||
log.Printf("clientConnection: Got connection %v for client %v", agentToServerYamux, clientId)
|
|
||||||
s.Nil(err)
|
s.Nil(err)
|
||||||
return agentToServerYamux, err
|
return agentToServerYamux, err
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package testsupport
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@ -32,8 +31,7 @@ func NewTestListener(ctx context.Context, listener net.Listener) *TestAgentListe
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
conn, err := res.Accept()
|
_, err := res.Accept()
|
||||||
log.Printf("testlistener: Got connection %v %v", conn, err)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -57,11 +55,9 @@ func (l *TestAgentListener) Accept() (net.Conn, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
localAddr := conn.LocalAddr().String()
|
localAddr := conn.LocalAddr().String()
|
||||||
log.Printf("testlistener: Storing connection %v %v", localAddr, conn)
|
|
||||||
l.mutex.Lock()
|
l.mutex.Lock()
|
||||||
defer l.mutex.Unlock()
|
defer l.mutex.Unlock()
|
||||||
l.connections[localAddr] = conn
|
l.connections[localAddr] = conn
|
||||||
log.Printf("testlistener: broadcasting %v", localAddr)
|
|
||||||
l.cond.Broadcast()
|
l.cond.Broadcast()
|
||||||
return conn, err
|
return conn, err
|
||||||
}
|
}
|
||||||
@ -73,15 +69,12 @@ func (l *TestAgentListener) GetConnection(localAddr string) (net.Conn, error) {
|
|||||||
// at this point in time will not be caught, and if there are no further broadcasts happening, then
|
// at this point in time will not be caught, and if there are no further broadcasts happening, then
|
||||||
// the code will hang her.
|
// the code will hang her.
|
||||||
for ok := l.connections[localAddr] != nil; !ok; ok = l.connections[localAddr] != nil {
|
for ok := l.connections[localAddr] != nil; !ok; ok = l.connections[localAddr] != nil {
|
||||||
log.Println("Listener cond wait")
|
|
||||||
l.cond.Wait()
|
l.cond.Wait()
|
||||||
log.Println("Listener awoken")
|
|
||||||
select {
|
select {
|
||||||
case <-l.ctx.Done():
|
case <-l.ctx.Done():
|
||||||
return nil, errors.New("Listenere terminated because context canceled")
|
return nil, errors.New("Listenere terminated because context canceled")
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Printf("Returning connection %v %v", localAddr, l.connections[localAddr])
|
|
||||||
return l.connections[localAddr], nil
|
return l.connections[localAddr], nil
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,6 @@ func PrintStackTraces() {
|
|||||||
func BidirectionalConnectionCheck(s *suite.Suite, msg string, clientToServerRW io.ReadWriteCloser, agentToServerYamux io.ReadWriter) {
|
func BidirectionalConnectionCheck(s *suite.Suite, msg string, clientToServerRW io.ReadWriteCloser, agentToServerYamux io.ReadWriter) {
|
||||||
data1 := msg + " -> "
|
data1 := msg + " -> "
|
||||||
data2 := msg + " <- "
|
data2 := msg + " <- "
|
||||||
log.Printf("BIDIRECTIONAL CHECK %v", msg)
|
|
||||||
RunAndWait(
|
RunAndWait(
|
||||||
s,
|
s,
|
||||||
func() any {
|
func() any {
|
||||||
|
Loading…
Reference in New Issue
Block a user