Add missing DatabasesReady event to DB proxy (#10152)

* Add missing DatabasesReady

* Expect TeleportReadyEvent to be emitted when DB proxy run in tests.
This commit is contained in:
Jakub Nyckowski 2022-02-10 21:37:24 -05:00 committed by GitHub
parent ba317929d4
commit ed62fa17c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -838,6 +838,8 @@ func (i *TeleInstance) StartDatabase(conf *service.Config) (*service.TeleportPro
conf.UploadEventsC = i.UploadEventsC
conf.Auth.Enabled = false
conf.Proxy.Enabled = false
conf.Apps.Enabled = false
conf.SSH.Enabled = false
// Create a new Teleport process and add it to the list of nodes that
// compose this "cluster".
@ -852,6 +854,7 @@ func (i *TeleInstance) StartDatabase(conf *service.Config) (*service.TeleportPro
expectedEvents := []string{
service.DatabasesIdentityEvent,
service.DatabasesReady,
service.TeleportReadyEvent,
}
// Start the process and block until the expected events have arrived.
@ -1110,6 +1113,9 @@ func (i *TeleInstance) Start() error {
if i.Config.Apps.Enabled {
expectedEvents = append(expectedEvents, service.AppsReady)
}
if i.Config.Databases.Enabled {
expectedEvents = append(expectedEvents, service.DatabasesReady)
}
// Start the process and block until the expected events have arrived.
receivedEvents, err := startAndWait(i.Process, expectedEvents)

View file

@ -765,6 +765,9 @@ func NewTeleport(cfg *Config) (*TeleportProcess, error) {
if cfg.Apps.Enabled {
eventMapping.In = append(eventMapping.In, AppsReady)
}
if cfg.Databases.Enabled {
eventMapping.In = append(eventMapping.In, DatabasesReady)
}
if cfg.Metrics.Enabled {
eventMapping.In = append(eventMapping.In, MetricsReady)
}