Module: Datadog::CI::Utils::TestRun

Defined in:
lib/datadog/ci/utils/test_run.rb

Class Method Summary collapse

Class Method Details

.commandObject



11
12
13
14
15
# File 'lib/datadog/ci/utils/test_run.rb', line 11

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

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

.custom_configuration(env_tags) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/datadog/ci/utils/test_run.rb', line 30

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

.datadog_test_id(test_name, suite, parameters = nil) ⇒ Object



17
18
19
# File 'lib/datadog/ci/utils/test_run.rb', line 17

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

.test_optimization_data_cached?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/datadog/ci/utils/test_run.rb', line 48

def self.test_optimization_data_cached?
  Dir.exist?(Ext::DDTest::TESTOPTIMIZATION_CACHE_PATH)
end

.test_parameters(arguments: {}, metadata: {}) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/datadog/ci/utils/test_run.rb', line 21

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

.virtual_cpu_countObject



42
43
44
45
46
# File 'lib/datadog/ci/utils/test_run.rb', line 42

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

  @virtual_cpu_count = ::Etc.nprocessors
end