added initialization test
This commit is contained in:
parent
d6912316a8
commit
7b7827824e
@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"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() {
|
func (s *AgentServerTestSuite) Test_ListenForAgentEvents() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,8 @@ type ProtocolVersion struct {
|
|||||||
// initialization mesaage when agent connects to server
|
// initialization mesaage when agent connects to server
|
||||||
|
|
||||||
type ServerInfo struct {
|
type ServerInfo struct {
|
||||||
|
// used for testing only.
|
||||||
|
TestId int
|
||||||
}
|
}
|
||||||
|
|
||||||
// confirmation message when agent connects
|
// confirmation message when agent connects
|
||||||
|
Loading…
Reference in New Issue
Block a user