Sha256: 73dd74a3301e13696704cc50024be010194ef05f3367f5c7c99390483a9cafa2

Contents?: true

Size: 1.06 KB

Versions: 7

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "etc"

module Datadog
  module CI
    module Utils
      module TestRun
        def self.command
          return @command if defined?(@command)

          @command = "#{$0} #{ARGV.join(" ")}"
        end

        def self.datadog_test_id(test_name, suite, parameters = nil)
          "#{suite}.#{test_name}.#{parameters}"
        end

        def self.test_parameters(arguments: {}, metadata: {})
          JSON.generate(
            {
              arguments: arguments,
              metadata: metadata
            }
          )
        end

        def self.custom_configuration(env_tags)
          return {} if env_tags.nil?

          res = {}
          env_tags.each do |tag, value|
            next unless tag.start_with?("test.configuration.")

            res[tag.sub("test.configuration.", "")] = value
          end
          res
        end

        def self.virtual_cpu_count
          return @virtual_cpu_count if defined?(@virtual_cpu_count)

          @virtual_cpu_count = ::Etc.nprocessors
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
datadog-ci-1.11.0 lib/datadog/ci/utils/test_run.rb
datadog-ci-1.10.0 lib/datadog/ci/utils/test_run.rb
datadog-ci-1.9.0 lib/datadog/ci/utils/test_run.rb
datadog-ci-1.8.1 lib/datadog/ci/utils/test_run.rb
datadog-ci-1.8.0 lib/datadog/ci/utils/test_run.rb
datadog-ci-1.7.0 lib/datadog/ci/utils/test_run.rb
datadog-ci-1.6.0 lib/datadog/ci/utils/test_run.rb