From ed62fa17c6a09f393459da9cf8c33730d695a55a Mon Sep 17 00:00:00 2001 From: Jakub Nyckowski Date: Thu, 10 Feb 2022 21:37:24 -0500 Subject: [PATCH] Add missing DatabasesReady event to DB proxy (#10152) * Add missing DatabasesReady * Expect TeleportReadyEvent to be emitted when DB proxy run in tests. --- integration/helpers.go | 6 ++++++ lib/service/service.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/integration/helpers.go b/integration/helpers.go index 049a99a0dcf..cd657abafe1 100644 --- a/integration/helpers.go +++ b/integration/helpers.go @@ -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) diff --git a/lib/service/service.go b/lib/service/service.go index a39112e958e..b688f6bfea1 100644 --- a/lib/service/service.go +++ b/lib/service/service.go @@ -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) }