Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDTEST-997] parallel tests gem support #299

Merged
merged 29 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
edba57c
add parallel_tests contrib
anmarchenko Mar 11, 2025
d246764
minimal working test session from the parallel_tests gem
anmarchenko Mar 12, 2025
0472f89
basic tracing works with parallel_tests gem
anmarchenko Mar 13, 2025
ba4d726
remove code that is no longer needed
anmarchenko Mar 13, 2025
b37f3b4
add basic cursor rules
anmarchenko Mar 13, 2025
c0d8785
more cursor rules
anmarchenko Mar 14, 2025
93ef5ad
fix failing require
anmarchenko Mar 14, 2025
6e1c20b
extract rspec version from Gem.loaded_specs when starting parallel_te…
anmarchenko Mar 14, 2025
bce74e4
test visibility component stores the known tests in tempfile and trie…
anmarchenko Mar 14, 2025
659650c
add "distributed" flag to the TestSession, store the component's glob…
anmarchenko Mar 17, 2025
f08fe32
Extract stateful component logic
anmarchenko Mar 17, 2025
491a4c9
make TestOptimisation::Component stateful when test session is distri…
anmarchenko Mar 18, 2025
021f374
Make TestManagement::Component stateful to support distributed test runs
anmarchenko Mar 18, 2025
22e03bf
Make Remote::Component stateful to cache library configuration in dis…
anmarchenko Mar 18, 2025
b771e63
small typing fix
anmarchenko Mar 18, 2025
d181297
Do not run git upload in worker processe in a distributed test session
anmarchenko Mar 18, 2025
5c764ab
unit test showing that parent process for ParallelTests starts the te…
anmarchenko Mar 18, 2025
024fadd
test parallel_tests instrumentation with version 4 and 5 of parallel_…
anmarchenko Mar 18, 2025
2536960
small typo
anmarchenko Mar 18, 2025
4ea267e
do not emit telemetry metrics when attempting to start test session o…
anmarchenko Mar 20, 2025
f9e9deb
make remote/local contexts even more confusing: when running under pa…
anmarchenko Mar 20, 2025
162cf85
remove debug logging
anmarchenko Mar 20, 2025
322b93f
move some telemetry calls from TestVisibility::Component to the Context
anmarchenko Mar 21, 2025
3c6831e
rename Global store to Process store to better indicate its purpose
anmarchenko Mar 21, 2025
e31fe2d
rename Store::Local to Store::FiberLocal to better communicating the …
anmarchenko Mar 21, 2025
7d1c0c8
introduce readonly TestSession/TestModule variants that only store mi…
anmarchenko Mar 21, 2025
2250aba
implement local_test_suites_mode to control test suite execution cont…
anmarchenko Mar 24, 2025
cf1dfea
set test service from context in a correct way (use remote test sessi…
anmarchenko Mar 24, 2025
460aba3
fix unfortunate mistake with attr_reader location
anmarchenko Mar 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .cursor/rules/ruby-style.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
description:
globs: *.rb
alwaysApply: false
---
You are an expert in Ruby, prioritizing writing safe and performant code.

## Ruby usage

- We use Ruby 2.7 syntax
- Use exceptions for exceptional cases, not for control flow.
- Implement proper error logging and user-friendly messages.

## Type checking

- We use RBS for static typing, our type signatures are in the sig/* folder
- When making changes, always update the corresponding RBS files
- Run `bundle exec rake steep:check` to confirm that there are no typing errors
- When deleting Ruby files, delete corresponding RBS file. Run `bundle exec rake rbs:clean` to make sure that there are no unnecessary RBS files.
- Avoid using `untyped` type, use it only when it is not feasible to derive the correct type

## Testing

- Write comprehensive tests using RSpec
- Avoid using `instance_variable_set` in tests, use mocking when needed
- The main rake task to run all tests is `bundle exec rake ci`
- If new files are created, run `git add -A` before running tests (otherwise `release_gem_spec.rb` will fail)
- Avoid making changes to `release_gem_spec.rb` if not asked

## Git

- use `git --no-pager diff` command to inspect changes before commit (use this command only when asked to commit)
12 changes: 12 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,25 @@ def self.with_cuprite_gem(cuprite_versions: 0, capybara_versions: 3)
end
end

def self.with_parallel_tests_gem(parallel_tests_versions: 5, rspec_versions: 3)
Array(parallel_tests_versions).each do |parallel_tests_v|
Array(rspec_versions).each do |rspec_v|
appraise "parallel_tests-#{parallel_tests_v}-rspec-#{rspec_v}" do
gem "parallel_tests", "~> #{parallel_tests_v}"
gem "rspec", "~> #{rspec_v}"
end
end
end
end

major, minor, = RUBY_VERSION.segments

with_minitest_gem
with_rspec_gem
with_cucumber_gem(versions: 3..9)
with_ci_queue_minitest_gem
with_ci_queue_rspec_gem
with_parallel_tests_gem(parallel_tests_versions: 4..5) if Gem::Version.new("3.2") <= RUBY_VERSION
with_minitest_shoulda_context_gem if Gem::Version.new("3.1") <= RUBY_VERSION
with_active_support_gem(versions: 4..7)
with_knapsack_pro_rspec_gem(knapsack_pro_versions: 7..8)
Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ TEST_METADATA = {
},
"timecop" => {
"timecop-0" => "✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby"
},
"parallel_tests" => {
"parallel_tests-4-rspec-3" => "❌ 2.7 / ❌ 3.0 / ❌ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby",
"parallel_tests-5-rspec-3" => "❌ 2.7 / ❌ 3.0 / ❌ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby"
}
}

Expand Down Expand Up @@ -159,6 +163,7 @@ namespace :spec do
selenium
timecop
cuprite
parallel_tests
].each do |contrib|
desc "" # "Explicitly hiding from `rake -T`"
RSpec::Core::RakeTask.new(contrib) do |t, args|
Expand Down
1 change: 1 addition & 0 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ target :lib do
library "webmock"
library "simplecov"
library "cuprite"
library "parallel_tests"
end
26 changes: 26 additions & 0 deletions gemfiles/jruby_9.4_parallel_tests_4_rspec_3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rake-compiler"
gem "simplecov"
gem "rspec", "~> 3"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "appraisal"
gem "climate_control"
gem "webmock"
gem "rake"
gem "yard"
gem "os"
gem "parallel_tests", "~> 4"

group :check do

end

group :development do

end

gemspec path: "../"
98 changes: 98 additions & 0 deletions gemfiles/jruby_9.4_parallel_tests_4_rspec_3.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
PATH
remote: ..
specs:
datadog-ci (1.14.0)
datadog (~> 2.4)
drb
msgpack

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
bigdecimal (3.1.9-java)
climate_control (1.2.0)
crack (1.0.0)
bigdecimal
rexml
datadog (2.12.2)
datadog-ruby_core_source (~> 3.4)
libdatadog (~> 16.0.1.1.0)
libddwaf (~> 1.18.0.0.1)
logger
msgpack
datadog-ruby_core_source (3.4.0)
diff-lcs (1.6.0)
docile (1.4.1)
drb (2.2.1)
ffi (1.17.1-java)
hashdiff (1.1.2)
libdatadog (16.0.1.1.0)
libddwaf (1.18.0.0.1-java)
ffi (~> 1.0)
logger (1.6.6)
msgpack (1.8.0-java)
os (1.1.4)
parallel (1.26.3)
parallel_tests (4.10.1)
parallel
public_suffix (6.0.1)
rake (13.2.1)
rake-compiler (1.2.9)
rake
rexml (3.4.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-collection_matchers (1.2.1)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
thor (1.3.2)
webmock (3.25.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
yard (0.9.37)

PLATFORMS
universal-java-11

DEPENDENCIES
appraisal
climate_control
datadog-ci!
os
parallel_tests (~> 4)
rake
rake-compiler
rspec (~> 3)
rspec-collection_matchers
rspec_junit_formatter
simplecov
webmock
yard

BUNDLED WITH
2.3.26
26 changes: 26 additions & 0 deletions gemfiles/jruby_9.4_parallel_tests_5_rspec_3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rake-compiler"
gem "simplecov"
gem "rspec", "~> 3"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "appraisal"
gem "climate_control"
gem "webmock"
gem "rake"
gem "yard"
gem "os"
gem "parallel_tests", "~> 5"

group :check do

end

group :development do

end

gemspec path: "../"
98 changes: 98 additions & 0 deletions gemfiles/jruby_9.4_parallel_tests_5_rspec_3.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
PATH
remote: ..
specs:
datadog-ci (1.14.0)
datadog (~> 2.4)
drb
msgpack

GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
bigdecimal (3.1.9-java)
climate_control (1.2.0)
crack (1.0.0)
bigdecimal
rexml
datadog (2.12.2)
datadog-ruby_core_source (~> 3.4)
libdatadog (~> 16.0.1.1.0)
libddwaf (~> 1.18.0.0.1)
logger
msgpack
datadog-ruby_core_source (3.4.0)
diff-lcs (1.6.0)
docile (1.4.1)
drb (2.2.1)
ffi (1.17.1-java)
hashdiff (1.1.2)
libdatadog (16.0.1.1.0)
libddwaf (1.18.0.0.1-java)
ffi (~> 1.0)
logger (1.6.6)
msgpack (1.8.0-java)
os (1.1.4)
parallel (1.26.3)
parallel_tests (5.1.0)
parallel
public_suffix (6.0.1)
rake (13.2.1)
rake-compiler (1.2.9)
rake
rexml (3.4.1)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-collection_matchers (1.2.1)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.2)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
thor (1.3.2)
webmock (3.25.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
yard (0.9.37)

PLATFORMS
universal-java-11

DEPENDENCIES
appraisal
climate_control
datadog-ci!
os
parallel_tests (~> 5)
rake
rake-compiler
rspec (~> 3)
rspec-collection_matchers
rspec_junit_formatter
simplecov
webmock
yard

BUNDLED WITH
2.3.26
27 changes: 27 additions & 0 deletions gemfiles/ruby_3.2_parallel_tests_4_rspec_3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "debug"
gem "rake-compiler"
gem "simplecov"
gem "rspec", "~> 3"
gem "rspec-collection_matchers"
gem "rspec_junit_formatter"
gem "appraisal"
gem "climate_control"
gem "webmock"
gem "rake"
gem "yard"
gem "os"
gem "parallel_tests", "~> 4"

group :check do

end

group :development do

end

gemspec path: "../"
Loading
Loading