diff --git a/pkg/server/admin/admin_test.go b/pkg/server/admin/admin_test.go index 0457cfe..2035484 100644 --- a/pkg/server/admin/admin_test.go +++ b/pkg/server/admin/admin_test.go @@ -77,7 +77,7 @@ func (s *AdminTestSuite) agentRegisters(requestedPublicId, assignedPublicId stri res := testsupport.RunAndWait( &s.Suite, func() any { - return s.addAgent(requestedPublicId, serverRW) + return s.addAgent(requestedPublicId, assignedPublicId, serverRW) }, func() any { return s.agentRegistration(assignedPublicId, agentRW) @@ -112,7 +112,11 @@ func (s *AdminTestSuite) Test_ManyAgentsRegister() { agentConn := entry.(*agentConnection) 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 { @@ -129,12 +133,12 @@ func (s *AdminTestSuite) agentRegistration(expectedPublicId string, agentRW io.R 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( s.hostKey, models.RendezVousId(publicId), comms.EnvironmentInfo{}, serverRW) s.Nil(err) - s.Equal(publicId, string(agentConn.Info.PublicId)) + s.Equal(assignedPublicId, string(agentConn.Info.PublicId)) return agentConn }