From f868ae99b8558e53bd13daab5a77ca4edf2ecf01 Mon Sep 17 00:00:00 2001 From: Tedi Mitiku Date: Fri, 8 Nov 2024 10:29:38 -0800 Subject: [PATCH] revert timeout --- .../persistent_volume_logs_database_client.go | 2 +- .../persistent_volume_logs_database_client_test.go | 4 ++-- engine/server/engine/server/engine_connect_server_service.go | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/engine/server/engine/centralized_logs/client_implementations/persistent_volume/persistent_volume_logs_database_client.go b/engine/server/engine/centralized_logs/client_implementations/persistent_volume/persistent_volume_logs_database_client.go index 16497b53c5..1afdd99f30 100644 --- a/engine/server/engine/centralized_logs/client_implementations/persistent_volume/persistent_volume_logs_database_client.go +++ b/engine/server/engine/centralized_logs/client_implementations/persistent_volume/persistent_volume_logs_database_client.go @@ -93,7 +93,7 @@ func (client *persistentVolumeLogsDatabaseClient) StreamUserServiceLogs( // wait for stream go routine to end wgSenders.Wait() - // flush should send remainder of logs in the channel + // flush should send remainder of logs in the buffer to the channel to be read logLineSender.Flush() close(logsByKurtosisUserServiceUuidChan) diff --git a/engine/server/engine/centralized_logs/client_implementations/persistent_volume/persistent_volume_logs_database_client_test.go b/engine/server/engine/centralized_logs/client_implementations/persistent_volume/persistent_volume_logs_database_client_test.go index ff2ea2813c..0f5197b1c5 100644 --- a/engine/server/engine/centralized_logs/client_implementations/persistent_volume/persistent_volume_logs_database_client_test.go +++ b/engine/server/engine/centralized_logs/client_implementations/persistent_volume/persistent_volume_logs_database_client_test.go @@ -47,7 +47,7 @@ const ( notFoundedFilterText = "it shouldn't be found in the log lines" firstMatchRegexFilterStr = "Starting.*idempotently'" - testTimeOut = 15 * time.Second + testTimeOut = 2 * time.Minute doNotFollowLogs = false defaultYear = 2023 @@ -719,7 +719,7 @@ func executeStreamCallAndGetReceivedServiceLogLines( for shouldReceiveStream { select { case <-time.Tick(testTimeOut): - return receivedServiceLogsByUuid, nil + return nil, stacktrace.NewError("Receiving stream logs in the test has reached the '%v' time out", testTimeOut) case streamErr, isChanOpen := <-errChan: if !isChanOpen { if len(userServiceLogsByUuidChan) == 0 { diff --git a/engine/server/engine/server/engine_connect_server_service.go b/engine/server/engine/server/engine_connect_server_service.go index 7b40725544..0003c5482d 100644 --- a/engine/server/engine/server/engine_connect_server_service.go +++ b/engine/server/engine/server/engine_connect_server_service.go @@ -346,7 +346,8 @@ func (service *EngineConnectServerService) GetServiceLogs(ctx context.Context, c select { //stream case case serviceLogsByServiceUuid, isChanOpen := <-serviceLogsByServiceUuidChan: - //If the channel is closed means that the logs database client won't continue sending streams + // If the channel is closed means that the logs database client won't continue sending streams + // but keep reading from it until the channel is empty if !isChanOpen && len(serviceLogsByServiceUuidChan) == 0 { logrus.Debug("Exiting the stream loop after receiving a close signal from the service logs by service UUID channel") return nil @@ -359,9 +360,9 @@ func (service *EngineConnectServerService) GetServiceLogs(ctx context.Context, c //client cancel ctx case case <-contextWithCancel.Done(): if len(serviceLogsByServiceUuidChan) == 0 { + logrus.Debug("The user service logs stream has done") return nil } - logrus.Debug("The user service logs stream has done") //error from logs database case case err, isChanOpen := <-errChan: if isChanOpen {