From 3d8c2eeace5bfd101660b9c46a341a76e1fbc134 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 3 Sep 2024 14:03:28 +0200 Subject: [PATCH] remove monkey patch of core identity module --- lib/datadog/ci/configuration/components.rb | 5 ----- lib/datadog/ci/utils/identity.rb | 20 ------------------- sig/datadog/ci/utils/identity.rbs | 13 ------------ .../ci/configuration/components_spec.rb | 4 ---- 4 files changed, 42 deletions(-) delete mode 100644 lib/datadog/ci/utils/identity.rb delete mode 100644 sig/datadog/ci/utils/identity.rbs diff --git a/lib/datadog/ci/configuration/components.rb b/lib/datadog/ci/configuration/components.rb index 55231eb2..2127c3c4 100644 --- a/lib/datadog/ci/configuration/components.rb +++ b/lib/datadog/ci/configuration/components.rb @@ -19,7 +19,6 @@ require_relative "../test_visibility/transport" require_relative "../transport/adapters/telemetry_webmock_safe_adapter" require_relative "../transport/api/builder" -require_relative "../utils/identity" require_relative "../utils/parsing" require_relative "../utils/test_run" require_relative "../worker" @@ -274,12 +273,8 @@ def configure_telemetry(settings) settings.telemetry.shutdown_timeout_seconds = 60.0 begin - require "datadog/core/environment/identity" require "datadog/core/telemetry/http/adapters/net" - # patch gem's identity to report datadog-ci library version instead of datadog gem version - Core::Environment::Identity.include(CI::Utils::Identity) - # patch gem's telemetry transport layer to use Net::HTTP instead of WebMock's Net::HTTP Core::Telemetry::Http::Adapters::Net.include(CI::Transport::Adapters::TelemetryWebmockSafeAdapter) rescue => e diff --git a/lib/datadog/ci/utils/identity.rb b/lib/datadog/ci/utils/identity.rb deleted file mode 100644 index 6e8720b0..00000000 --- a/lib/datadog/ci/utils/identity.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -module Datadog - module CI - module Utils - module Identity - def self.included(base) - base.singleton_class.prepend(ClassMethods) - end - - module ClassMethods - # return datadog-ci gem version instead of datadog gem version - def gem_datadog_version - Datadog::CI::VERSION::STRING - end - end - end - end - end -end diff --git a/sig/datadog/ci/utils/identity.rbs b/sig/datadog/ci/utils/identity.rbs deleted file mode 100644 index 72a8b76e..00000000 --- a/sig/datadog/ci/utils/identity.rbs +++ /dev/null @@ -1,13 +0,0 @@ -module Datadog - module CI - module Utils - module Identity - def self.included: (untyped base) -> void - - module ClassMethods - def gem_datadog_version: () -> String - end - end - end - end -end diff --git a/spec/datadog/ci/configuration/components_spec.rb b/spec/datadog/ci/configuration/components_spec.rb index 15d5d15d..aa120a9c 100644 --- a/spec/datadog/ci/configuration/components_spec.rb +++ b/spec/datadog/ci/configuration/components_spec.rb @@ -159,10 +159,6 @@ expect(settings.telemetry).to have_received(:enabled=).with(true) end - it "patches Core::Environment::Identity module to replace the library version" do - expect(Datadog::Core::Environment::Identity.gem_datadog_version).to eq(Datadog::CI::VERSION::STRING) - end - it "patches Datadog::Core::Telemetry::Http::Adapters::Net" do expect(Datadog::Core::Telemetry::Http::Adapters::Net).to be < Datadog::CI::Transport::Adapters::TelemetryWebmockSafeAdapter end