removed some old debugging output

This commit is contained in:
Erik Brakkee 2024-08-27 18:40:25 +02:00
parent 8fe79e3c38
commit 74b7b7d5e1
4 changed files with 2 additions and 14 deletions

View File

@ -14,7 +14,7 @@ vet: fmt
go vet ./...
test: build
go test -count=1 ./...
go test -count=1 ${TESTFLAGS} ./...
build: generate vet
mkdir -p bin

View File

@ -12,7 +12,6 @@ import (
"github.com/stretchr/testify/suite"
"go.uber.org/goleak"
"io"
"log"
"net"
"net/http"
"strings"
@ -272,7 +271,6 @@ func (s *AdminTestSuite) connectClientToAgent(
return nil, err
}
log.Println("Got agentToServerYamux")
serverToAgentYamux := clientConn.agentConnection
// 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) {
// agent
log.Printf("clientConnection: Getting connection for %v", clientId)
agentToServerYamux, err := listener.GetConnection(string(clientId))
log.Printf("clientConnection: Got connection %v for client %v", agentToServerYamux, clientId)
s.Nil(err)
return agentToServerYamux, err
}

View File

@ -3,7 +3,6 @@ package testsupport
import (
"context"
"errors"
"log"
"net"
"sync"
)
@ -32,8 +31,7 @@ func NewTestListener(ctx context.Context, listener net.Listener) *TestAgentListe
go func() {
for {
conn, err := res.Accept()
log.Printf("testlistener: Got connection %v %v", conn, err)
_, err := res.Accept()
if err != nil {
return
}
@ -57,11 +55,9 @@ func (l *TestAgentListener) Accept() (net.Conn, error) {
return nil, err
}
localAddr := conn.LocalAddr().String()
log.Printf("testlistener: Storing connection %v %v", localAddr, conn)
l.mutex.Lock()
defer l.mutex.Unlock()
l.connections[localAddr] = conn
log.Printf("testlistener: broadcasting %v", localAddr)
l.cond.Broadcast()
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
// the code will hang her.
for ok := l.connections[localAddr] != nil; !ok; ok = l.connections[localAddr] != nil {
log.Println("Listener cond wait")
l.cond.Wait()
log.Println("Listener awoken")
select {
case <-l.ctx.Done():
return nil, errors.New("Listenere terminated because context canceled")
default:
}
}
log.Printf("Returning connection %v %v", localAddr, l.connections[localAddr])
return l.connections[localAddr], nil
}

View File

@ -105,7 +105,6 @@ func PrintStackTraces() {
func BidirectionalConnectionCheck(s *suite.Suite, msg string, clientToServerRW io.ReadWriteCloser, agentToServerYamux io.ReadWriter) {
data1 := msg + " -> "
data2 := msg + " <- "
log.Printf("BIDIRECTIONAL CHECK %v", msg)
RunAndWait(
s,
func() any {