tested connections through the session.

This commit is contained in:
Erik Brakkee 2024-08-20 12:16:02 +02:00
parent c25b4b4df9
commit 11c894e906

View File

@ -97,6 +97,32 @@ func (s *AgentServerTestSuite) TestNewCommChannel() {
log.Printf("%v %v", agentCommChannel, serverCommChannel)
}
func (s *AgentServerTestSuite) Test_ConnectThroughYamux() {
agentCommChannel, serverCommChannel := s.createCommChannel()
data := "hello"
testsupport.RunAndWait(
&s.Suite,
func() any {
conn, err := agentCommChannel.Session.OpenStream()
s.Nil(err)
n, err := conn.Write([]byte(data))
s.Nil(err)
s.Equal(len(data), n)
return nil
},
func() any {
conn, err := serverCommChannel.Session.Accept()
s.Nil(err)
buf := make([]byte, len(data))
n, err := conn.Read(buf)
s.Nil(err)
s.Equal(len(data), n)
s.Equal([]byte(data), buf[:n])
return nil
})
}
func (s *AgentServerTestSuite) Test_ListenForAgentEvents() {
}