test-queue 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f689a4cffa234a32b4e3919fe2f263258cd32682925c29d59e26fdd0a8218236
4
- data.tar.gz: 5e2f51214fa2dfcc184386fc588767f7ce15ac9738de0a3c8a730aed33995669
3
+ metadata.gz: a84d8eb24f2cdebe31f18be510d2ba28c8633e963beb62e498ef32674df3f761
4
+ data.tar.gz: 9869e95d639d312876faa0264b238ee8702ec21f5e5bc0bfe0d149ea1d83df31
5
5
  SHA512:
6
- metadata.gz: 1f76dbac0466294ffca4a780f7c411611cba1c55006a22343bdc11d789e400b135d4457c889d591498ede4ec92dd12ce615239f3569667b061117729e2e61fbc
7
- data.tar.gz: a9666ce78f35e7d1a4cf3f877782ef86b7909396fb12f27c6df883f483ff07907db6b3a9ced68c2f36eae55b2d3f28c9ed3699df3b4ed9a1fc9151b9147306a8
6
+ metadata.gz: 7a33f1567709b2fda5670cac096733d0ab1e029fe4db18aec6e1a449b00dd919e979167febe5a249b875d28e536224f0680dfb9810f2b585ea6064fcdb500dcf
7
+ data.tar.gz: 2486c1c8a85b4fe9fbe87eb98b7aa76ea97e01951f7e66d6db64e91dae57f8692f8354d036a7d57c342a46ab2833c6aac9fb7263b138fdb802d6993765a2e9b4
@@ -26,6 +26,7 @@ jobs:
26
26
  - { name: minitest4, bats: test/minitest4.bats }
27
27
  - { name: minitest5, bats: test/minitest5.bats }
28
28
  - { name: rspec3, bats: test/rspec3.bats }
29
+ - { name: rspec4, bats: test/rspec4.bats }
29
30
  - { name: testunit, bats: test/testunit.bats }
30
31
 
31
32
  steps:
data/.gitignore CHANGED
@@ -3,4 +3,5 @@
3
3
  Gemfile.lock
4
4
  gemfiles/.bundle/
5
5
  *.gemfile.lock
6
+ pkg
6
7
  vendor
data/Appraisals CHANGED
@@ -30,6 +30,14 @@ appraise "rspec3" do
30
30
  gem 'rspec', '~> 3.12'
31
31
  end
32
32
 
33
+ appraise "rspec4" do
34
+ gem 'rspec', github: 'rspec/rspec-metagem', branch: '4-0-dev'
35
+ gem 'rspec-core', github: 'rspec/rspec-core', branch: '4-0-dev'
36
+ gem 'rspec-expectations', github: 'rspec/rspec-expectations', branch: '4-0-dev'
37
+ gem 'rspec-mocks', github: 'rspec/rspec-mocks', branch: '4-0-dev'
38
+ gem 'rspec-support', github: 'rspec/rspec-support', branch: '4-0-dev'
39
+ end
40
+
33
41
  appraise "testunit" do
34
42
  gem 'test-unit'
35
43
  end
@@ -0,0 +1,11 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem 'rspec', github: 'rspec/rspec-metagem', branch: '4-0-dev'
6
+ gem 'rspec-core', github: 'rspec/rspec-core', branch: '4-0-dev'
7
+ gem 'rspec-expectations', github: 'rspec/rspec-expectations', branch: '4-0-dev'
8
+ gem 'rspec-mocks', github: 'rspec/rspec-mocks', branch: '4-0-dev'
9
+ gem 'rspec-support', github: 'rspec/rspec-support', branch: '4-0-dev'
10
+
11
+ gemspec path: "../"
@@ -8,7 +8,7 @@ module TestQueue
8
8
  @suite_stats = []
9
9
  @sock = sock
10
10
  @filter = filter
11
- if @sock =~ /^(.+):(\d+)$/
11
+ if @sock =~ /\A(.+):(\d+)\z/
12
12
  @tcp_address = $1
13
13
  @tcp_port = $2.to_i
14
14
  end
@@ -4,10 +4,10 @@ require 'rspec/core'
4
4
  case ::RSpec::Core::Version::STRING.to_i
5
5
  when 2
6
6
  require_relative 'rspec2'
7
- when 3
7
+ when 3, 4
8
8
  require_relative 'rspec3'
9
9
  else
10
- fail 'requires rspec version 2 or 3'
10
+ fail 'requires rspec version 2, 3, or 4'
11
11
  end
12
12
 
13
13
  module TestQueue
@@ -31,7 +31,7 @@ module TestQueue
31
31
  attr_accessor :concurrency, :exit_when_done
32
32
  attr_reader :stats
33
33
 
34
- TOKEN_REGEX = /^TOKEN=(\w+)/
34
+ TOKEN_REGEX = /\ATOKEN=(\w+)/
35
35
 
36
36
  def initialize(test_framework, concurrency=nil, socket=nil, relay=nil)
37
37
  @test_framework = test_framework
@@ -251,7 +251,7 @@ module TestQueue
251
251
 
252
252
  def start_master
253
253
  if !relay?
254
- if @socket =~ /^(?:(.+):)?(\d+)$/
254
+ if @socket =~ /\A(?:(.+):)?(\d+)\z/
255
255
  address = $1 || '0.0.0.0'
256
256
  port = $2.to_i
257
257
  @socket = "#$1:#$2"
@@ -500,7 +500,7 @@ module TestQueue
500
500
  end
501
501
 
502
502
  case cmd
503
- when /^POP (\S+) (\d+)/
503
+ when /\APOP (\S+) (\d+)/
504
504
  hostname = $1
505
505
  pid = Integer($2)
506
506
  if awaiting_suites?
@@ -510,7 +510,7 @@ module TestQueue
510
510
  sock.write(data)
511
511
  @assignments[obj] = [hostname, pid]
512
512
  end
513
- when /^REMOTE MASTER (\d+) ([\w\.-]+)(?: (.+))?/
513
+ when /\AREMOTE MASTER (\d+) ([\w\.-]+)(?: (.+))?/
514
514
  num = $1.to_i
515
515
  remote_master = $2
516
516
  remote_master_message = $3
@@ -521,15 +521,15 @@ module TestQueue
521
521
  message = "*** #{num} workers connected from #{remote_master} after #{Time.now-@start_time}s"
522
522
  message << " " + remote_master_message if remote_master_message
523
523
  STDERR.puts message
524
- when /^WORKER (\d+)/
524
+ when /\AWORKER (\d+)/
525
525
  data = sock.read($1.to_i)
526
526
  worker = Marshal.load(data)
527
527
  worker_completed(worker)
528
528
  remote_workers -= 1
529
- when /^NEW SUITE (.+)/
529
+ when /\ANEW SUITE (.+)/
530
530
  suite_name, path = Marshal.load($1)
531
531
  enqueue_discovered_suite(suite_name, path)
532
- when /^KABOOM/
532
+ when /\AKABOOM/
533
533
  # worker reporting an abnormal number of test failures;
534
534
  # stop everything immediately and report the results.
535
535
  break
data/test/rspec4.bats ADDED
@@ -0,0 +1,56 @@
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 +1,3 @@
1
-
2
- shared_examples_for 'Sample Example' do
3
- it { should eq 5 }
1
+ RSpec::shared_examples_for 'Sample Example' do
2
+ it { is_expected.to eq 5 }
4
3
  end
5
-
@@ -1,13 +1,13 @@
1
1
  require 'rspec'
2
2
 
3
- describe 'RSpecEqual' do
3
+ RSpec::describe 'RSpecEqual' do
4
4
  it 'checks equality' do
5
5
  expect(1).to eq 1
6
6
  end
7
7
  end
8
8
 
9
9
  30.times do |i|
10
- describe "RSpecSleep(#{i})" do
10
+ RSpec::describe "RSpecSleep(#{i})" do
11
11
  it "sleeps" do
12
12
  start = Time.now
13
13
  sleep(0.25)
@@ -17,7 +17,7 @@ end
17
17
  end
18
18
 
19
19
  if ENV["FAIL"]
20
- describe 'RSpecFailure' do
20
+ RSpec::describe 'RSpecFailure' do
21
21
  it 'fails' do
22
22
  expect(:foo).to eq :bar
23
23
  end
@@ -1,6 +1,6 @@
1
1
  require "rspec"
2
2
 
3
- describe 'SplittableGroup', :no_split => !!ENV["NOSPLIT"] do
3
+ RSpec::describe 'SplittableGroup', :no_split => !!ENV["NOSPLIT"] do
4
4
  2.times do |i|
5
5
  it "runs test #{i}" do
6
6
  # Sleep longer in CI to make the distribution of examples across workers
@@ -1,8 +1,7 @@
1
1
  require 'rspec'
2
2
  require_relative 'sample_rspec_helper'
3
3
 
4
- describe 'Use SharedExamplesFor test_1' do
4
+ RSpec::describe 'Use SharedExamplesFor test_1' do
5
5
  subject { 5 }
6
6
  it_behaves_like 'Sample Example'
7
7
  end
8
-
@@ -1,8 +1,7 @@
1
1
  require 'rspec'
2
2
  require_relative 'sample_rspec_helper'
3
3
 
4
- describe 'Use SharedExamplesFor test_2' do
4
+ RSpec::describe 'Use SharedExamplesFor test_2' do
5
5
  subject { 5 }
6
6
  it_behaves_like 'Sample Example'
7
7
  end
8
-
data/test-queue.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'test-queue'
3
- s.version = '0.6.0'
3
+ s.version = '0.7.0'
4
4
  s.required_ruby_version = '>= 2.7.0'
5
5
  s.summary = 'parallel test runner'
6
6
  s.description = 'minitest/rspec parallel test runner for CI environments'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test-queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Gupta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-17 00:00:00.000000000 Z
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: minitest/rspec parallel test runner for CI environments
14
14
  email: ruby@tmm1.net
@@ -37,6 +37,7 @@ files:
37
37
  - gemfiles/minitest5.gemfile
38
38
  - gemfiles/rspec2.gemfile
39
39
  - gemfiles/rspec3.gemfile
40
+ - gemfiles/rspec4.gemfile
40
41
  - gemfiles/testunit.gemfile
41
42
  - lib/test-queue.rb
42
43
  - lib/test_queue.rb
@@ -62,6 +63,7 @@ files:
62
63
  - test/minitest5.bats
63
64
  - test/rspec2.bats
64
65
  - test/rspec3.bats
66
+ - test/rspec4.bats
65
67
  - test/samples/features/bad.feature
66
68
  - test/samples/features/sample.feature
67
69
  - test/samples/features/sample2.feature
@@ -98,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
100
  - !ruby/object:Gem::Version
99
101
  version: '0'
100
102
  requirements: []
101
- rubygems_version: 3.4.6
103
+ rubygems_version: 3.3.26
102
104
  signing_key:
103
105
  specification_version: 4
104
106
  summary: parallel test runner