Skip to content

Commit 88a123c

Browse files
authored
Replace Zeus with process forking strategy (#271)
Integration tests without Zeus are very slow because we run each example in a new process, which has to load all dependencies and frameworks – like RSpec, SuperDiff, ActiveSupport, etc – from scratch. Zeus improved on this, but has a client-server architecture and has been proving somewhat difficult to use. If we instead load the dependencies and then run RSpec in a new [_forked_](https://man7.org/linux/man-pages/man2/fork.2.html) subprocess, we don't have to reload anything loaded before fork time, and don't have to use Zeus. Light testing shows a ~5x speed-up over non-Zeus integration tests.
1 parent 9943ecc commit 88a123c

33 files changed

+586
-273
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ pkg
66
spec/examples.txt
77
spec/internal
88
tmp
9-
zeus.server.log
10-
zeus.server-start.log
119

1210
# Ignore Yarn stuff
1311
.pnp.*

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
- Switch from Prettier to Rubocop. [#269](https://github.com/splitwise/super_diff/pull/269)
1414
- Fix outdated reference in documentation. [#270](https://github.com/splitwise/super_diff/pull/270) by [@emmanuel-ferdman](https://github.com/emmanuel-ferdman)
15+
- Replace Zeus with forking strategy for tests. [#271](https://github.com/splitwise/super_diff/pull/271)
1516

1617
## 0.13.0 - 2024-09-22
1718

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ gem 'rubocop'
1616
gem 'syntax_tree'
1717
gem 'syntax_tree-haml'
1818
gem 'syntax_tree-rbs'
19-
gem 'warnings_logger'
2019

2120
gemspec

Gemfile.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ GEM
8383
thor (1.3.2)
8484
tilt (2.4.0)
8585
unicode-display_width (2.6.0)
86-
warnings_logger (0.1.1)
8786

8887
PLATFORMS
8988
arm64-darwin-21
@@ -105,7 +104,6 @@ DEPENDENCIES
105104
syntax_tree
106105
syntax_tree-haml
107106
syntax_tree-rbs
108-
warnings_logger
109107

110108
BUNDLED WITH
111109
2.5.20

bin/start-dev

Lines changed: 0 additions & 82 deletions
This file was deleted.

docs/contributors/architecture/structure.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -244,28 +244,17 @@ They are divided into two kinds:
244244
holds tests for individual classes and methods.
245245
- **Integration tests**, located in `spec/integration/`,
246246
construct tiny test suites which import SuperDiff
247-
and run them in isolated environments
247+
and run them in forked processes
248248
to ensure that SuperDiff works as designed
249-
in more real-world scenarios.
249+
in more real-world scenarios. We fork instead of
250+
running from scratch to avoid having to reload
251+
SuperDiff and other libraries for every example.
250252

251253
The files in `spec/support/` (imported via `spec_helper.rb`)
252254
contain helpers, matchers, and tests
253255
that are shared among unit and integration tests,
254256
at their respective levels.
255257

256-
Beyond this, [Zeus][zeus], a way to speed up integration tests,
257-
and is run and configured via these files:
258-
259-
- `bin/start-dev`
260-
- `config/zeus_plan.rb`
261-
- `support/test_plan.rb`
262-
- `zeus.json`
263-
264-
The [official Zeus docs](https://github.com/burke/zeus/blob/master/docs/ruby/modifying.md)
265-
is helpful for understanding how these files work together.
266-
267-
[zeus]: https://github.com/burke/zeus
268-
269258
## Ruby
270259

271260
The following files are used to set up Ruby,

docs/contributors/how-to-contribute.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,6 @@ bin/rspec spec/integration/...
6262
bin/rspec spec/unit/...
6363
```
6464

65-
Note that the integration tests
66-
can be quite slow to run.
67-
If you'd like to speed them up,
68-
run the following command in a separate terminal session:
69-
70-
```
71-
zeus start
72-
```
73-
74-
Now the next time you run an integration test by saying
75-
76-
```
77-
bin/rspec spec/integration/...
78-
```
79-
80-
it should run twice as fast.
81-
8265
## 5. Run the linter
8366

8467
Code is linted and formatted using Rubocop.

gemfiles/no_rails_rspec_gte_3_10.gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ gem "rubocop"
1414
gem "syntax_tree"
1515
gem "syntax_tree-haml"
1616
gem "syntax_tree-rbs"
17-
gem "warnings_logger"
1817
gem "rspec", "3.12.0"
1918
gem "rspec-core", "3.12.0"
2019
gem "rspec-expectations", "3.12.3"

gemfiles/no_rails_rspec_lt_3_10.gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ gem "rubocop"
1414
gem "syntax_tree"
1515
gem "syntax_tree-haml"
1616
gem "syntax_tree-rbs"
17-
gem "warnings_logger"
1817
gem "rspec", "~> 3.9.0"
1918

2019
gemspec path: "../"

gemfiles/rails_6_0_rspec_gte_3_10.gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ gem "rubocop"
1414
gem "syntax_tree"
1515
gem "syntax_tree-haml"
1616
gem "syntax_tree-rbs"
17-
gem "warnings_logger"
1817
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby
1918
gem "jdbc-sqlite3", platform: :jruby
2019
gem "net-ftp"

0 commit comments

Comments
 (0)