test-queue 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +42 -42
  3. data/exe/cucumber-queue +2 -1
  4. data/exe/minitest-queue +3 -2
  5. data/exe/rspec-queue +2 -1
  6. data/exe/testunit-queue +2 -1
  7. data/lib/test-queue.rb +2 -0
  8. data/lib/test_queue/iterator.rb +22 -14
  9. data/lib/test_queue/runner/cucumber.rb +3 -0
  10. data/lib/test_queue/runner/{sample.rb → example.rb} +30 -9
  11. data/lib/test_queue/runner/minitest.rb +5 -3
  12. data/lib/test_queue/runner/minitest4.rb +12 -7
  13. data/lib/test_queue/runner/minitest5.rb +37 -22
  14. data/lib/test_queue/runner/puppet_lint.rb +6 -4
  15. data/lib/test_queue/runner/rspec.rb +14 -3
  16. data/lib/test_queue/runner/rspec2.rb +24 -24
  17. data/lib/test_queue/runner/rspec3.rb +11 -11
  18. data/lib/test_queue/runner/testunit.rb +6 -3
  19. data/lib/test_queue/runner.rb +87 -97
  20. data/lib/test_queue/stats.rb +17 -13
  21. data/lib/test_queue/test_framework.rb +2 -0
  22. data/lib/test_queue/version.rb +5 -0
  23. data/lib/test_queue.rb +1 -5
  24. metadata +7 -44
  25. data/.github/workflows/test.yml +0 -94
  26. data/.gitignore +0 -7
  27. data/Appraisals +0 -43
  28. data/Gemfile +0 -7
  29. data/Rakefile +0 -14
  30. data/gemfiles/cucumber1_3.gemfile +0 -9
  31. data/gemfiles/cucumber2_4.gemfile +0 -9
  32. data/gemfiles/minitest4.gemfile +0 -7
  33. data/gemfiles/minitest5.gemfile +0 -7
  34. data/gemfiles/rspec2.gemfile +0 -8
  35. data/gemfiles/rspec3.gemfile +0 -7
  36. data/gemfiles/rspec4.gemfile +0 -11
  37. data/gemfiles/testunit.gemfile +0 -7
  38. data/script/bootstrap +0 -13
  39. data/spec/stats_spec.rb +0 -79
  40. data/test/cucumber.bats +0 -57
  41. data/test/minitest4.bats +0 -34
  42. data/test/minitest5.bats +0 -194
  43. data/test/rspec2.bats +0 -46
  44. data/test/rspec3.bats +0 -56
  45. data/test/rspec4.bats +0 -56
  46. data/test/samples/features/bad.feature +0 -5
  47. data/test/samples/features/sample.feature +0 -25
  48. data/test/samples/features/sample2.feature +0 -29
  49. data/test/samples/features/step_definitions/common.rb +0 -19
  50. data/test/samples/sample_minispec.rb +0 -37
  51. data/test/samples/sample_minitest4.rb +0 -25
  52. data/test/samples/sample_minitest5.rb +0 -33
  53. data/test/samples/sample_rspec_helper.rb +0 -1
  54. data/test/samples/sample_shared_examples_for_spec.rb +0 -3
  55. data/test/samples/sample_spec.rb +0 -25
  56. data/test/samples/sample_split_spec.rb +0 -17
  57. data/test/samples/sample_testunit.rb +0 -25
  58. data/test/samples/sample_use_shared_example1_spec.rb +0 -7
  59. data/test/samples/sample_use_shared_example2_spec.rb +0 -7
  60. data/test/sleepy_runner.rb +0 -16
  61. data/test/testlib.bash +0 -89
  62. data/test/testunit.bats +0 -20
  63. data/test-queue.gemspec +0 -21
data/test/minitest5.bats DELETED
@@ -1,194 +0,0 @@
1
- load "testlib"
2
-
3
- SCRATCH=tmp/minitest5-tests
4
-
5
- setup() {
6
- require_gem "minitest" "~> 5.0"
7
- rm -rf $SCRATCH
8
- mkdir -p $SCRATCH
9
- }
10
-
11
- teardown() {
12
- rm -rf $SCRATCH
13
- }
14
-
15
- @test "minitest-queue (minitest5) succeeds when all tests pass" {
16
- run bundle exec minitest-queue ./test/samples/*_minitest5.rb
17
- assert_status 0
18
- assert_output_contains "Starting test-queue master"
19
- }
20
-
21
- @test "minitest-queue (minitest5) fails when a test fails" {
22
- export FAIL=1
23
- run bundle exec minitest-queue ./test/samples/*_minitest5.rb
24
- assert_status 1
25
- assert_output_contains "Starting test-queue master"
26
- assert_output_contains "1) Failure:"
27
- assert_output_contains "MiniTestFailure#test_fail"
28
- }
29
-
30
- @test "TEST_QUEUE_FORCE allowlists certain tests" {
31
- export TEST_QUEUE_WORKERS=1 TEST_QUEUE_FORCE="MiniTestSleep11,MiniTestSleep8"
32
- run bundle exec minitest-queue ./test/samples/*_minitest5.rb
33
- assert_status 0
34
- assert_output_contains "Starting test-queue master"
35
- assert_output_contains "MiniTestSleep11"
36
- assert_output_contains "MiniTestSleep8"
37
- refute_output_contains "MiniTestSleep9"
38
- }
39
-
40
- assert_test_queue_force_ordering() {
41
- run bundle exec minitest-queue "$@"
42
- assert_status 0
43
- assert_output_contains "Starting test-queue master"
44
-
45
- # Turn the list of suites that were run into a comma-separated list. Input
46
- # looks like:
47
- # SuiteName: . <0.001>
48
- actual_tests=$(echo "$output" | \
49
- egrep '^ .*: \.+ <' | \
50
- sed -E -e 's/^ (.*): \.+.*/\1/' | \
51
- tr '\n' ',' | \
52
- sed -e 's/,$//')
53
- assert_equal "$TEST_QUEUE_FORCE" "$actual_tests"
54
- }
55
-
56
- @test "TEST_QUEUE_FORCE ensures test ordering" {
57
- export TEST_QUEUE_WORKERS=1 TEST_QUEUE_FORCE="Meme::when asked about cheeseburgers,MiniTestEqual"
58
-
59
- # Without stats file
60
- rm -f .test_queue_stats
61
- assert_test_queue_force_ordering ./test/samples/sample_minitest5.rb ./test/samples/sample_minispec.rb
62
- rm -f .test_queue_stats
63
- assert_test_queue_force_ordering ./test/samples/sample_minispec.rb ./test/samples/sample_minitest5.rb
64
-
65
- # With stats file
66
- assert_test_queue_force_ordering ./test/samples/sample_minitest5.rb ./test/samples/sample_minispec.rb
67
- assert_test_queue_force_ordering ./test/samples/sample_minispec.rb ./test/samples/sample_minitest5.rb
68
- }
69
-
70
- @test "minitest-queue fails if TEST_QUEUE_FORCE specifies nonexistent tests" {
71
- export TEST_QUEUE_WORKERS=1 TEST_QUEUE_FORCE="MiniTestSleep11,DoesNotExist"
72
- run bundle exec minitest-queue ./test/samples/*_minitest5.rb
73
- assert_status 1
74
- assert_output_contains "Failed to discover DoesNotExist specified in TEST_QUEUE_FORCE"
75
- }
76
-
77
- @test "multi-master central master succeeds when all tests pass" {
78
- export TEST_QUEUE_RELAY_TOKEN=$(date | cksum | cut -d' ' -f1)
79
- export SLEEP_AS_RELAY=1
80
- TEST_QUEUE_RELAY=0.0.0.0:12345 bundle exec ruby ./test/sleepy_runner.rb ./test/samples/sample_minitest5.rb || true &
81
- sleep 0.1
82
- TEST_QUEUE_SOCKET=0.0.0.0:12345 run bundle exec ruby ./test/sleepy_runner.rb ./test/samples/sample_minitest5.rb
83
- wait
84
-
85
- assert_status 0
86
- assert_output_contains "Starting test-queue master"
87
- }
88
-
89
- @test "multi-master remote master succeeds when all tests pass" {
90
- export TEST_QUEUE_RELAY_TOKEN=$(date | cksum | cut -d' ' -f1)
91
- export SLEEP_AS_MASTER=1
92
- TEST_QUEUE_SOCKET=0.0.0.0:12345 bundle exec ruby ./test/sleepy_runner.rb ./test/samples/sample_minitest5.rb || true &
93
- sleep 0.1
94
- TEST_QUEUE_RELAY=0.0.0.0:12345 run bundle exec ruby ./test/sleepy_runner.rb ./test/samples/sample_minitest5.rb
95
- wait
96
-
97
- assert_status 0
98
- assert_output_contains "Starting test-queue master"
99
- }
100
-
101
- @test "multi-master central master fails when a test fails" {
102
- export FAIL=1
103
- export SLEEP_AS_RELAY=1
104
- export TEST_QUEUE_RELAY_TOKEN=$(date | cksum | cut -d' ' -f1)
105
- TEST_QUEUE_RELAY=0.0.0.0:12345 bundle exec ruby ./test/sleepy_runner.rb ./test/samples/sample_minitest5.rb || true &
106
- sleep 0.1
107
- TEST_QUEUE_SOCKET=0.0.0.0:12345 run bundle exec ruby ./test/sleepy_runner.rb ./test/samples/sample_minitest5.rb
108
- wait
109
-
110
- assert_status 1
111
- assert_output_contains "Starting test-queue master"
112
- assert_output_contains "1) Failure:"
113
- assert_output_contains "MiniTestFailure#test_fail"
114
- }
115
-
116
- @test "multi-master remote master fails when a test fails" {
117
- export FAIL=1
118
- export SLEEP_AS_MASTER=1
119
- export TEST_QUEUE_RELAY_TOKEN=$(date | cksum | cut -d' ' -f1)
120
- TEST_QUEUE_SOCKET=0.0.0.0:12345 bundle exec ruby ./test/sleepy_runner.rb ./test/samples/sample_minitest5.rb || true &
121
- sleep 0.1
122
- TEST_QUEUE_RELAY=0.0.0.0:12345 run bundle exec ruby ./test/sleepy_runner.rb ./test/samples/sample_minitest5.rb
123
- wait
124
-
125
- assert_status 1
126
- assert_output_contains "Starting test-queue master"
127
- assert_output_contains "1) Failure:"
128
- assert_output_contains "MiniTestFailure#test_fail"
129
- }
130
-
131
- @test "multi-master central master prints out remote master messages" {
132
- export TEST_QUEUE_RELAY_TOKEN=$(date | cksum | cut -d' ' -f1)
133
- TEST_QUEUE_RELAY=0.0.0.0:12345 TEST_QUEUE_REMOTE_MASTER_MESSAGE="hello from remote master" bundle exec minitest-queue ./test/samples/sample_minitest5.rb &
134
- TEST_QUEUE_SOCKET=0.0.0.0:12345 run bundle exec minitest-queue ./test/samples/sample_minitest5.rb
135
- wait
136
-
137
- assert_status 0
138
- assert_output_contains "hello from remote master"
139
- }
140
-
141
- @test "recovers from child processes dying in an unorderly way" {
142
- export KILL=1
143
- run bundle exec minitest-queue ./test/samples/sample_minitest5.rb
144
- assert_status 1
145
- assert_output_contains "SIGKILL (signal 9)"
146
- }
147
-
148
- @test "minitest-queue fails when TEST_QUEUE_WORKERS is <= 0" {
149
- export TEST_QUEUE_WORKERS=0
150
- run bundle exec minitest-queue ./test/samples/sample_minitest5.rb
151
- assert_status 1
152
- assert_output_contains "Worker count (0) must be greater than 0"
153
- }
154
-
155
- @test "minitest-queue fails when given a missing test file" {
156
- run bundle exec minitest-queue ./test/samples/does_not_exist.rb
157
- assert_status 1
158
- assert_output_contains "Aborting: Discovering suites failed"
159
- }
160
-
161
- @test "minitest-queue fails when given a malformed test file" {
162
- [ -f README.md ]
163
- run bundle exec minitest-queue README.md
164
- assert_status 1
165
- assert_output_contains "Aborting: Discovering suites failed"
166
- }
167
-
168
- @test "minitest-queue handles test file being deleted" {
169
- cp test/samples/sample_mini{test5,spec}.rb $SCRATCH
170
-
171
- run bundle exec minitest-queue $SCRATCH/*
172
- assert_status 0
173
- assert_output_contains "Meme::when asked about blending possibilities"
174
-
175
- rm $SCRATCH/sample_minispec.rb
176
-
177
- run bundle exec minitest-queue $SCRATCH/*
178
- assert_status 0
179
- refute_output_contains "Meme::when asked about blending possibilities"
180
- }
181
-
182
- @test "minitest-queue handles suites changing inside a file" {
183
- cp test/samples/sample_minispec.rb $SCRATCH
184
-
185
- run bundle exec minitest-queue $SCRATCH/sample_minispec.rb
186
- assert_status 0
187
- assert_output_contains "Meme::when asked about blending possibilities"
188
-
189
- sed -i'' -e 's/Meme/Meme2/g' $SCRATCH/sample_minispec.rb
190
-
191
- run bundle exec minitest-queue $SCRATCH/sample_minispec.rb
192
- assert_status 0
193
- assert_output_contains "Meme2::when asked about blending possibilities"
194
- }
data/test/rspec2.bats DELETED
@@ -1,46 +0,0 @@
1
- load "testlib"
2
-
3
- setup() {
4
- require_gem "rspec" "~> 2.0"
5
- }
6
-
7
- @test "rspec-queue succeeds when all specs pass" {
8
- run bundle exec rspec-queue ./test/samples/sample_spec.rb
9
- assert_status 0
10
- assert_output_contains "Starting test-queue master"
11
- }
12
-
13
- @test "rspec-queue fails when a spec fails" {
14
- export FAIL=1
15
- run bundle exec rspec-queue ./test/samples/sample_spec.rb
16
- assert_status 1
17
- assert_output_contains "1) RSpecFailure fails"
18
- assert_output_contains "RSpecFailure fails"
19
- assert_output_contains "expected: :bar"
20
- assert_output_contains "got: :foo"
21
- }
22
-
23
- @test "TEST_QUEUE_SPLIT_GROUPS splits splittable groups" {
24
- export TEST_QUEUE_SPLIT_GROUPS=true
25
- run bundle exec rspec-queue ./test/samples/sample_split_spec.rb
26
- assert_status 0
27
-
28
- assert_output_matches '\[ 1\] +1 example, 0 failures'
29
- assert_output_matches '\[ 2\] +1 example, 0 failures'
30
- }
31
-
32
- @test "TEST_QUEUE_SPLIT_GROUPS does not split unsplittable groups" {
33
- export TEST_QUEUE_SPLIT_GROUPS=true
34
- export NOSPLIT=1
35
- run bundle exec rspec-queue ./test/samples/sample_split_spec.rb
36
- assert_status 0
37
-
38
- assert_output_contains "2 examples, 0 failures"
39
- assert_output_contains "0 examples, 0 failures"
40
- }
41
-
42
- @test "rspec-queue supports shared example groups" {
43
- run bundle exec rspec-queue ./test/samples/sample_use_shared_example1_spec.rb \
44
- ./test/samples/sample_use_shared_example2_spec.rb
45
- assert_status 0
46
- }
data/test/rspec3.bats DELETED
@@ -1,56 +0,0 @@
1
- load "testlib"
2
-
3
- setup() {
4
- require_gem "rspec" "~> 3.0"
5
- }
6
-
7
- @test "rspec-queue succeeds when all specs pass" {
8
- run bundle exec rspec-queue ./test/samples/sample_spec.rb
9
- assert_status 0
10
- assert_output_contains "Starting test-queue master"
11
- assert_output_contains "16 examples, 0 failures"
12
- assert_output_contains "16 examples, 0 failures"
13
- }
14
-
15
- @test "rspec-queue succeeds all specs pass in the default spec directory even if directory path is omitted" {
16
- run bundle exec rspec-queue
17
- assert_status 0
18
- assert_output_contains "Starting test-queue master"
19
- assert_output_contains "6 examples, 0 failures"
20
- assert_output_contains "0 examples, 0 failures"
21
- }
22
-
23
- @test "rspec-queue fails when a spec fails" {
24
- export FAIL=1
25
- run bundle exec rspec-queue ./test/samples/sample_spec.rb
26
- assert_status 1
27
- assert_output_contains "1) RSpecFailure fails"
28
- assert_output_contains "RSpecFailure fails"
29
- assert_output_contains "expected: :bar"
30
- assert_output_contains "got: :foo"
31
- }
32
-
33
- @test "TEST_QUEUE_SPLIT_GROUPS splits splittable groups" {
34
- export TEST_QUEUE_SPLIT_GROUPS=true
35
- run bundle exec rspec-queue ./test/samples/sample_split_spec.rb
36
- assert_status 0
37
-
38
- assert_output_matches '\[ 1\] +1 example, 0 failures'
39
- assert_output_matches '\[ 2\] +1 example, 0 failures'
40
- }
41
-
42
- @test "TEST_QUEUE_SPLIT_GROUPS does not split unsplittable groups" {
43
- export TEST_QUEUE_SPLIT_GROUPS=true
44
- export NOSPLIT=1
45
- run bundle exec rspec-queue ./test/samples/sample_split_spec.rb
46
- assert_status 0
47
-
48
- assert_output_contains "2 examples, 0 failures"
49
- assert_output_contains "0 examples, 0 failures"
50
- }
51
-
52
- @test "rspec-queue supports shared example groups" {
53
- run bundle exec rspec-queue ./test/samples/sample_use_shared_example1_spec.rb \
54
- ./test/samples/sample_use_shared_example2_spec.rb
55
- assert_status 0
56
- }
data/test/rspec4.bats DELETED
@@ -1,56 +0,0 @@
1
- load "testlib"
2
-
3
- setup() {
4
- require_gem "rspec" "4.0.0.pre"
5
- }
6
-
7
- @test "rspec-queue succeeds when all specs pass" {
8
- run bundle exec rspec-queue ./test/samples/sample_spec.rb
9
- assert_status 0
10
- assert_output_contains "Starting test-queue master"
11
- assert_output_contains "16 examples, 0 failures"
12
- assert_output_contains "16 examples, 0 failures"
13
- }
14
-
15
- @test "rspec-queue succeeds all specs pass in the default spec directory even if directory path is omitted" {
16
- run bundle exec rspec-queue
17
- assert_status 0
18
- assert_output_contains "Starting test-queue master"
19
- assert_output_contains "6 examples, 0 failures"
20
- assert_output_contains "0 examples, 0 failures"
21
- }
22
-
23
- @test "rspec-queue fails when a spec fails" {
24
- export FAIL=1
25
- run bundle exec rspec-queue ./test/samples/sample_spec.rb
26
- assert_status 1
27
- assert_output_contains "1) RSpecFailure fails"
28
- assert_output_contains "RSpecFailure fails"
29
- assert_output_contains "expected: :bar"
30
- assert_output_contains "got: :foo"
31
- }
32
-
33
- @test "TEST_QUEUE_SPLIT_GROUPS splits splittable groups" {
34
- export TEST_QUEUE_SPLIT_GROUPS=true
35
- run bundle exec rspec-queue ./test/samples/sample_split_spec.rb
36
- assert_status 0
37
-
38
- assert_output_matches '\[ 1\] +1 example, 0 failures'
39
- assert_output_matches '\[ 2\] +1 example, 0 failures'
40
- }
41
-
42
- @test "TEST_QUEUE_SPLIT_GROUPS does not split unsplittable groups" {
43
- export TEST_QUEUE_SPLIT_GROUPS=true
44
- export NOSPLIT=1
45
- run bundle exec rspec-queue ./test/samples/sample_split_spec.rb
46
- assert_status 0
47
-
48
- assert_output_contains "2 examples, 0 failures"
49
- assert_output_contains "0 examples, 0 failures"
50
- }
51
-
52
- @test "rspec-queue supports shared example groups" {
53
- run bundle exec rspec-queue ./test/samples/sample_use_shared_example1_spec.rb \
54
- ./test/samples/sample_use_shared_example2_spec.rb
55
- assert_status 0
56
- }
@@ -1,5 +0,0 @@
1
- Feature: bad
2
- Scenario: failure
3
- Given a
4
- When bad
5
- Then c
@@ -1,25 +0,0 @@
1
- Feature: Foobar
2
- Scenario: Bar
3
- Given a
4
- When b
5
- Then c
6
- Scenario: Baz
7
- Given a
8
- When b
9
- Then c
10
- Scenario: Bam
11
- Given a
12
- When b
13
- Then c
14
- Scenario: Car
15
- Given a
16
- When b
17
- Then c
18
- Scenario: Caz
19
- Given a
20
- When b
21
- Then c
22
- Scenario: Cam
23
- Given a
24
- When b
25
- Then c
@@ -1,29 +0,0 @@
1
- Feature: Foobar2
2
- Scenario: Bar
3
- Given a
4
- When b
5
- Then c
6
- Scenario: Baz
7
- Given a
8
- When b
9
- Then c
10
- Scenario: Bam
11
- Given a
12
- When b
13
- Then c
14
- Scenario: Car
15
- Given a
16
- When b
17
- Then c
18
- Scenario: Caz
19
- Given a
20
- When b
21
- Then c
22
- Scenario: Cam
23
- Given a
24
- When b
25
- Then c
26
- Scenario: failure
27
- Given a
28
- When bad
29
- Then c
@@ -1,19 +0,0 @@
1
- Given(/^a$/) do
2
- sleep 0.10
3
- end
4
-
5
- When(/^b$/) do
6
- sleep 0.25
7
- end
8
-
9
- When(/^bad$/) do
10
- if ENV["FAIL"]
11
- 1.should == 0
12
- else
13
- 1.should == 1
14
- end
15
- end
16
-
17
- Then(/^c$/) do
18
- 1.should == 1
19
- end
@@ -1,37 +0,0 @@
1
- require 'minitest/spec'
2
-
3
- class Meme
4
- def i_can_has_cheezburger?
5
- "OHAI!"
6
- end
7
-
8
- def will_it_blend?
9
- "YES!"
10
- end
11
- end
12
-
13
- describe Meme do
14
- before do
15
- @meme = Meme.new
16
- end
17
-
18
- describe "when asked about cheeseburgers" do
19
- it "must respond positively" do
20
- sleep 0.1
21
- @meme.i_can_has_cheezburger?.must_equal "OHAI!"
22
- end
23
- end
24
-
25
- describe "when asked about blending possibilities" do
26
- it "won't say no" do
27
- sleep 0.1
28
- @meme.will_it_blend?.wont_match /^no/i
29
- end
30
-
31
- if ENV["FAIL"]
32
- it "fails" do
33
- @meme.will_it_blend?.must_equal "NO!"
34
- end
35
- end
36
- end
37
- end
@@ -1,25 +0,0 @@
1
- require 'minitest/unit'
2
-
3
- class MiniTestEqual < MiniTest::Unit::TestCase
4
- def test_equal
5
- assert_equal 1, 1
6
- end
7
- end
8
-
9
- 30.times do |i|
10
- Object.const_set("MiniTestSleep#{i}", Class.new(MiniTest::Unit::TestCase) do
11
- define_method('test_sleep') do
12
- start = Time.now
13
- sleep(0.25)
14
- assert_in_delta Time.now-start, 0.25, 0.02
15
- end
16
- end)
17
- end
18
-
19
- if ENV["FAIL"]
20
- class MiniTestFailure < MiniTest::Unit::TestCase
21
- def test_fail
22
- assert_equal 0, 1
23
- end
24
- end
25
- end
@@ -1,33 +0,0 @@
1
- require 'minitest/autorun'
2
-
3
- class MiniTestEqual < MiniTest::Test
4
- def test_equal
5
- assert_equal 1, 1
6
- end
7
- end
8
-
9
- 30.times do |i|
10
- Object.const_set("MiniTestSleep#{i}", Class.new(MiniTest::Test) do
11
- define_method('test_sleep') do
12
- start = Time.now
13
- sleep(0.25)
14
- assert_in_delta Time.now-start, 0.25, 0.02
15
- end
16
- end)
17
- end
18
-
19
- if ENV["FAIL"]
20
- class MiniTestFailure < MiniTest::Test
21
- def test_fail
22
- assert_equal 0, 1
23
- end
24
- end
25
- end
26
-
27
- if ENV["KILL"]
28
- class MiniTestKilledFailure < MiniTest::Test
29
- def test_kill
30
- Process.kill(9, $$)
31
- end
32
- end
33
- end
@@ -1 +0,0 @@
1
- require_relative 'sample_shared_examples_for_spec'
@@ -1,3 +0,0 @@
1
- RSpec::shared_examples_for 'Sample Example' do
2
- it { is_expected.to eq 5 }
3
- end
@@ -1,25 +0,0 @@
1
- require 'rspec'
2
-
3
- RSpec::describe 'RSpecEqual' do
4
- it 'checks equality' do
5
- expect(1).to eq 1
6
- end
7
- end
8
-
9
- 30.times do |i|
10
- RSpec::describe "RSpecSleep(#{i})" do
11
- it "sleeps" do
12
- start = Time.now
13
- sleep(0.25)
14
- expect(Time.now-start).to be_within(0.02).of(0.25)
15
- end
16
- end
17
- end
18
-
19
- if ENV["FAIL"]
20
- RSpec::describe 'RSpecFailure' do
21
- it 'fails' do
22
- expect(:foo).to eq :bar
23
- end
24
- end
25
- end
@@ -1,17 +0,0 @@
1
- require "rspec"
2
-
3
- RSpec::describe 'SplittableGroup', :no_split => !!ENV["NOSPLIT"] do
4
- 2.times do |i|
5
- it "runs test #{i}" do
6
- # Sleep longer in CI to make the distribution of examples across workers
7
- # more deterministic.
8
- if ENV["CI"]
9
- sleep(5)
10
- else
11
- sleep(1)
12
- end
13
-
14
- expect(1).to eq 1
15
- end
16
- end
17
- end
@@ -1,25 +0,0 @@
1
- require 'test/unit'
2
-
3
- class TestUnitEqual < Test::Unit::TestCase
4
- def test_equal
5
- assert_equal 1, 1
6
- end
7
- end
8
-
9
- 30.times do |i|
10
- Object.const_set("TestUnitSleep#{i}", Class.new(Test::Unit::TestCase) do
11
- define_method('test_sleep') do
12
- start = Time.now
13
- sleep(0.25)
14
- assert_in_delta Time.now-start, 0.25, 0.02
15
- end
16
- end)
17
- end
18
-
19
- if ENV["FAIL"]
20
- class TestUnitFailure < Test::Unit::TestCase
21
- def test_fail
22
- assert_equal 0, 1
23
- end
24
- end
25
- end
@@ -1,7 +0,0 @@
1
- require 'rspec'
2
- require_relative 'sample_rspec_helper'
3
-
4
- RSpec::describe 'Use SharedExamplesFor test_1' do
5
- subject { 5 }
6
- it_behaves_like 'Sample Example'
7
- end
@@ -1,7 +0,0 @@
1
- require 'rspec'
2
- require_relative 'sample_rspec_helper'
3
-
4
- RSpec::describe 'Use SharedExamplesFor test_2' do
5
- subject { 5 }
6
- it_behaves_like 'Sample Example'
7
- end
@@ -1,16 +0,0 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
2
-
3
- require 'test_queue'
4
- require 'test_queue/runner/minitest'
5
-
6
- class SleepyTestRunner < TestQueue::Runner::MiniTest
7
- def after_fork(num)
8
- if ENV['SLEEP_AS_RELAY'] && relay?
9
- sleep 5
10
- elsif ENV['SLEEP_AS_MASTER'] && !relay?
11
- sleep 5
12
- end
13
- end
14
- end
15
-
16
- SleepyTestRunner.new.execute