Module: Datadog::CI::Contrib::ParallelTests::CLI::InstanceMethods
- Defined in:
- lib/datadog/ci/contrib/parallel_tests/cli.rb
Instance Method Summary collapse
- #any_test_failed?(test_results) ⇒ Boolean
- #datadog_configuration ⇒ Object
- #datadog_extract_rspec_version ⇒ Object
- #run_tests_in_parallel(num_processes, options) ⇒ Object
- #test_visibility_component ⇒ Object
Instance Method Details
#any_test_failed?(test_results) ⇒ Boolean
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/datadog/ci/contrib/parallel_tests/cli.rb', line 42 def any_test_failed?(test_results) res = super test_session = test_visibility_component.active_test_session test_module = test_visibility_component.active_test_module if res test_module&.failed! test_session&.failed! else test_module&.passed! test_session&.passed! end res end |
#datadog_configuration ⇒ Object
72 73 74 |
# File 'lib/datadog/ci/contrib/parallel_tests/cli.rb', line 72 def datadog_configuration Datadog.configuration.ci[:paralleltests] end |
#datadog_extract_rspec_version ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/datadog/ci/contrib/parallel_tests/cli.rb', line 58 def datadog_extract_rspec_version # Try to find either 'rspec' or 'rspec-core' gem if Gem.loaded_specs["rspec"] Gem.loaded_specs["rspec"].version.to_s elsif Gem.loaded_specs["rspec-core"] Gem.loaded_specs["rspec-core"].version.to_s else "0.0.0" end rescue => e Datadog.logger.debug("Error extracting RSpec version: #{e.class.name} - #{e.}") "0.0.0" end |
#run_tests_in_parallel(num_processes, options) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/datadog/ci/contrib/parallel_tests/cli.rb', line 16 def run_tests_in_parallel(num_processes, ) # only rspec runner is supported for now return super if @runner != ::ParallelTests::RSpec::Runner begin test_session = test_visibility_component.start_test_session( tags: { CI::Ext::Test::TAG_FRAMEWORK => CI::Contrib::RSpec::Ext::FRAMEWORK, CI::Ext::Test::TAG_FRAMEWORK_VERSION => datadog_extract_rspec_version }, service: datadog_configuration[:service_name], estimated_total_tests_count: 10_000, # temporary value, updated by child processes distributed: true ) test_module = test_visibility_component.start_test_module("rspec") [:env] ||= {} [:env][CI::Ext::Settings::ENV_TEST_VISIBILITY_DRB_SERVER_URI] = test_visibility_component.context_service_uri super ensure test_module&.finish test_session&.finish end end |
#test_visibility_component ⇒ Object
76 77 78 |
# File 'lib/datadog/ci/contrib/parallel_tests/cli.rb', line 76 def test_visibility_component Datadog.send(:components).test_visibility end |