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

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

Class Method Summary collapse

Class Method Details

.commandObject



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

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

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

.custom_configuration(env_tags) ⇒ Object



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

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



15
16
17
# File 'lib/datadog/ci/utils/test_run.rb', line 15

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

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



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

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

.virtual_cpu_countObject



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

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

  @virtual_cpu_count = ::Etc.nprocessors
end