added initialization test
This commit is contained in:
parent
61e95ab2eb
commit
ce45c59d33
@ -6,6 +6,7 @@ import (
|
||||
"github.com/stretchr/testify/suite"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
@ -141,6 +142,27 @@ func (s *AgentServerTestSuite) Test_ConnectThroughYamux() {
|
||||
})
|
||||
}
|
||||
|
||||
func (s *AgentServerTestSuite) Test_Initialization() {
|
||||
serverTestId := rand.Int()
|
||||
agentShell := "agentshell"
|
||||
testsupport.RunAndWait(
|
||||
&s.Suite,
|
||||
func() any {
|
||||
serverInfo, err := AgentInitialization(s.agentConnection,
|
||||
NewEnvironmentInfo(agentShell))
|
||||
s.Nil(err)
|
||||
s.Equal(serverTestId, serverInfo.TestId)
|
||||
return nil
|
||||
},
|
||||
func() any {
|
||||
serverInfo := ServerInfo{TestId: serverTestId}
|
||||
environmentInfo, err := ServerInitialization(s.serverConnection, serverInfo)
|
||||
s.Nil(err)
|
||||
s.Equal(agentShell, environmentInfo.Shell)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s *AgentServerTestSuite) Test_ListenForAgentEvents() {
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,8 @@ type ProtocolVersion struct {
|
||||
// initialization mesaage when agent connects to server
|
||||
|
||||
type ServerInfo struct {
|
||||
// used for testing only.
|
||||
TestId int
|
||||
}
|
||||
|
||||
// confirmation message when agent connects
|
||||
|
Loading…
Reference in New Issue
Block a user