From b58b477f2a5f45f1fa93c77e94a6a0a99bbc8019 Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 2 Sep 2024 15:38:09 +0200 Subject: [PATCH] configure test retries and test optimisation in parallel using threaded Workers --- lib/datadog/ci/remote/component.rb | 15 +++++++++++++-- lib/datadog/ci/test_retries/component.rb | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/datadog/ci/remote/component.rb b/lib/datadog/ci/remote/component.rb index 91a39c7f..35dd562e 100644 --- a/lib/datadog/ci/remote/component.rb +++ b/lib/datadog/ci/remote/component.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative "../worker" + module Datadog module CI module Remote @@ -27,8 +29,17 @@ def configure(test_session) end end - test_optimisation.configure(library_configuration, test_session) - test_retries.configure(library_configuration, test_session) + # configure different components in parallel because they might + configuration_workers = [ + Worker.new { test_optimisation.configure(library_configuration, test_session) }, + Worker.new { test_retries.configure(library_configuration, test_session) } + ] + + # launch configuration workers + configuration_workers.each(&:perform) + + # block until all workers are done (or 60 seconds has passed) + configuration_workers.each(&:wait_until_done) end private diff --git a/lib/datadog/ci/test_retries/component.rb b/lib/datadog/ci/test_retries/component.rb index 1da4bbd5..0406ace6 100644 --- a/lib/datadog/ci/test_retries/component.rb +++ b/lib/datadog/ci/test_retries/component.rb @@ -57,6 +57,8 @@ def configure(library_settings, test_session) if @retry_new_tests_unique_tests_set.empty? @retry_new_tests_enabled = false @retry_new_tests_fault_reason = "unique tests set is empty" + + Datadog.logger.debug("Unique tests set is empty, retrying new tests disabled") else Utils::Telemetry.distribution( Ext::Telemetry::METRIC_EFD_UNIQUE_TESTS_RESPONSE_TESTS,