agentlistener tested.
This commit is contained in:
parent
80488fa7c8
commit
0bc3548354
28
pkg/comms/agentlistener_test.go
Normal file
28
pkg/comms/agentlistener_test.go
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package comms
|
||||||
|
|
||||||
|
import "git.wamblee.org/converge/pkg/testsupport"
|
||||||
|
|
||||||
|
func (s *AgentServerTestSuite) Test_clientIdPassedAsLocalAddr() {
|
||||||
|
agentChannel, serverChannel := s.createCommChannel()
|
||||||
|
|
||||||
|
clientId := "myid"
|
||||||
|
testsupport.RunAndWait(
|
||||||
|
&s.Suite,
|
||||||
|
func() any {
|
||||||
|
listener := NewAgentListener(agentChannel.Session)
|
||||||
|
connection, err := listener.Accept()
|
||||||
|
s.Nil(err)
|
||||||
|
// clientId identifyable as remote addr
|
||||||
|
s.Equal(clientId, connection.LocalAddr().String())
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
func() any {
|
||||||
|
connection, err := serverChannel.Session.OpenStream()
|
||||||
|
s.Nil(err)
|
||||||
|
gobChannel := NewGOBChannel(connection)
|
||||||
|
clientInfo := ClientInfo{ClientId: clientId}
|
||||||
|
err = SendWithTimeout(gobChannel, clientInfo)
|
||||||
|
s.Nil(err)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user