agent registers with duplica id
This commit is contained in:
parent
1244e34de5
commit
37ff504b88
@ -77,7 +77,7 @@ func (s *AdminTestSuite) agentRegisters(requestedPublicId, assignedPublicId stri
|
|||||||
res := testsupport.RunAndWait(
|
res := testsupport.RunAndWait(
|
||||||
&s.Suite,
|
&s.Suite,
|
||||||
func() any {
|
func() any {
|
||||||
return s.addAgent(requestedPublicId, serverRW)
|
return s.addAgent(requestedPublicId, assignedPublicId, serverRW)
|
||||||
},
|
},
|
||||||
func() any {
|
func() any {
|
||||||
return s.agentRegistration(assignedPublicId, agentRW)
|
return s.agentRegistration(assignedPublicId, agentRW)
|
||||||
@ -112,7 +112,11 @@ func (s *AdminTestSuite) Test_ManyAgentsRegister() {
|
|||||||
agentConn := entry.(*agentConnection)
|
agentConn := entry.(*agentConnection)
|
||||||
s.Equal(agentConn.Info, state.Agents[agentConn.Info.Guid])
|
s.Equal(agentConn.Info, state.Agents[agentConn.Info.Guid])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *AdminTestSuite) Test_agentDuplicateId() {
|
||||||
|
s.agentRegisters("abc", "abc")
|
||||||
|
s.agentRegisters("abc", "abc-0")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AdminTestSuite) agentRegistration(expectedPublicId string, agentRW io.ReadWriteCloser) any {
|
func (s *AdminTestSuite) agentRegistration(expectedPublicId string, agentRW io.ReadWriteCloser) any {
|
||||||
@ -129,12 +133,12 @@ func (s *AdminTestSuite) agentRegistration(expectedPublicId string, agentRW io.R
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *AdminTestSuite) addAgent(publicId string, serverRW io.ReadWriteCloser) any {
|
func (s *AdminTestSuite) addAgent(publicId string, assignedPublicId string, serverRW io.ReadWriteCloser) any {
|
||||||
agentConn, err := s.admin.AddAgent(
|
agentConn, err := s.admin.AddAgent(
|
||||||
s.hostKey, models.RendezVousId(publicId), comms.EnvironmentInfo{},
|
s.hostKey, models.RendezVousId(publicId), comms.EnvironmentInfo{},
|
||||||
serverRW)
|
serverRW)
|
||||||
s.Nil(err)
|
s.Nil(err)
|
||||||
s.Equal(publicId, string(agentConn.Info.PublicId))
|
s.Equal(assignedPublicId, string(agentConn.Info.PublicId))
|
||||||
|
|
||||||
return agentConn
|
return agentConn
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user