test-queue 0.7.0 → 0.9.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.
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 +9 -9
  12. data/lib/test_queue/runner/minitest5.rb +37 -22
  13. data/lib/test_queue/runner/puppet_lint.rb +6 -4
  14. data/lib/test_queue/runner/rspec.rb +16 -10
  15. data/lib/test_queue/runner/{rspec3.rb → rspec_ext.rb} +11 -11
  16. data/lib/test_queue/runner/testunit.rb +6 -3
  17. data/lib/test_queue/runner.rb +82 -98
  18. data/lib/test_queue/stats.rb +17 -13
  19. data/lib/test_queue/test_framework.rb +2 -0
  20. data/lib/test_queue/version.rb +5 -0
  21. data/lib/test_queue.rb +1 -5
  22. metadata +8 -47
  23. data/.github/workflows/test.yml +0 -94
  24. data/.gitignore +0 -7
  25. data/Appraisals +0 -43
  26. data/Gemfile +0 -7
  27. data/Rakefile +0 -14
  28. data/gemfiles/cucumber1_3.gemfile +0 -9
  29. data/gemfiles/cucumber2_4.gemfile +0 -9
  30. data/gemfiles/minitest4.gemfile +0 -7
  31. data/gemfiles/minitest5.gemfile +0 -7
  32. data/gemfiles/rspec2.gemfile +0 -8
  33. data/gemfiles/rspec3.gemfile +0 -7
  34. data/gemfiles/rspec4.gemfile +0 -11
  35. data/gemfiles/testunit.gemfile +0 -7
  36. data/lib/test_queue/runner/minitest4.rb +0 -88
  37. data/lib/test_queue/runner/rspec2.rb +0 -44
  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
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.7.0
4
+ version: 0.9.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-26 00:00:00.000000000 Z
11
+ date: 2023-05-13 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
@@ -20,71 +20,32 @@ executables:
20
20
  extensions: []
21
21
  extra_rdoc_files: []
22
22
  files:
23
- - ".github/workflows/test.yml"
24
- - ".gitignore"
25
- - Appraisals
26
- - Gemfile
27
23
  - LICENSE
28
24
  - README.md
29
- - Rakefile
30
25
  - exe/cucumber-queue
31
26
  - exe/minitest-queue
32
27
  - exe/rspec-queue
33
28
  - exe/testunit-queue
34
- - gemfiles/cucumber1_3.gemfile
35
- - gemfiles/cucumber2_4.gemfile
36
- - gemfiles/minitest4.gemfile
37
- - gemfiles/minitest5.gemfile
38
- - gemfiles/rspec2.gemfile
39
- - gemfiles/rspec3.gemfile
40
- - gemfiles/rspec4.gemfile
41
- - gemfiles/testunit.gemfile
42
29
  - lib/test-queue.rb
43
30
  - lib/test_queue.rb
44
31
  - lib/test_queue/iterator.rb
45
32
  - lib/test_queue/runner.rb
46
33
  - lib/test_queue/runner/cucumber.rb
34
+ - lib/test_queue/runner/example.rb
47
35
  - lib/test_queue/runner/minitest.rb
48
- - lib/test_queue/runner/minitest4.rb
49
36
  - lib/test_queue/runner/minitest5.rb
50
37
  - lib/test_queue/runner/puppet_lint.rb
51
38
  - lib/test_queue/runner/rspec.rb
52
- - lib/test_queue/runner/rspec2.rb
53
- - lib/test_queue/runner/rspec3.rb
54
- - lib/test_queue/runner/sample.rb
39
+ - lib/test_queue/runner/rspec_ext.rb
55
40
  - lib/test_queue/runner/testunit.rb
56
41
  - lib/test_queue/stats.rb
57
42
  - lib/test_queue/test_framework.rb
58
- - script/bootstrap
59
- - spec/stats_spec.rb
60
- - test-queue.gemspec
61
- - test/cucumber.bats
62
- - test/minitest4.bats
63
- - test/minitest5.bats
64
- - test/rspec2.bats
65
- - test/rspec3.bats
66
- - test/rspec4.bats
67
- - test/samples/features/bad.feature
68
- - test/samples/features/sample.feature
69
- - test/samples/features/sample2.feature
70
- - test/samples/features/step_definitions/common.rb
71
- - test/samples/sample_minispec.rb
72
- - test/samples/sample_minitest4.rb
73
- - test/samples/sample_minitest5.rb
74
- - test/samples/sample_rspec_helper.rb
75
- - test/samples/sample_shared_examples_for_spec.rb
76
- - test/samples/sample_spec.rb
77
- - test/samples/sample_split_spec.rb
78
- - test/samples/sample_testunit.rb
79
- - test/samples/sample_use_shared_example1_spec.rb
80
- - test/samples/sample_use_shared_example2_spec.rb
81
- - test/sleepy_runner.rb
82
- - test/testlib.bash
83
- - test/testunit.bats
43
+ - lib/test_queue/version.rb
84
44
  homepage: https://github.com/tmm1/test-queue
85
45
  licenses:
86
46
  - MIT
87
- metadata: {}
47
+ metadata:
48
+ rubygems_mfa_required: 'true'
88
49
  post_install_message:
89
50
  rdoc_options: []
90
51
  require_paths:
@@ -100,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
61
  - !ruby/object:Gem::Version
101
62
  version: '0'
102
63
  requirements: []
103
- rubygems_version: 3.3.26
64
+ rubygems_version: 3.4.10
104
65
  signing_key:
105
66
  specification_version: 4
106
67
  summary: parallel test runner
@@ -1,94 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
-
9
- jobs:
10
- main:
11
- name: >-
12
- ${{ matrix.ruby }} ${{ matrix.entry.name }}
13
- runs-on: ${{ matrix.os }}-latest
14
- env:
15
- TEST_QUEUE_WORKERS: 2
16
- TEST_QUEUE_VERBOSE: 1
17
- strategy:
18
- fail-fast: false
19
- matrix:
20
- os: [ubuntu]
21
- # Lowest and Latest version.
22
- ruby: ['2.7', '3.2']
23
- entry:
24
- - { name: cucumber1_3, bats: test/cucumber.bats }
25
- - { name: cucumber2_4, bats: test/cucumber.bats }
26
- - { name: minitest4, bats: test/minitest4.bats }
27
- - { name: minitest5, bats: test/minitest5.bats }
28
- - { name: rspec3, bats: test/rspec3.bats }
29
- - { name: rspec4, bats: test/rspec4.bats }
30
- - { name: testunit, bats: test/testunit.bats }
31
-
32
- steps:
33
- - name: checkout
34
- uses: actions/checkout@v3
35
- - name: set up Ruby
36
- uses: ruby/setup-ruby@v1
37
- with:
38
- ruby-version: ${{ matrix.ruby }}
39
-
40
- - name: install dependencies
41
- run: bundle install --jobs 3 --retry 3
42
- - name: setup for Bats
43
- run: bundle exec rake setup
44
- - name: spec
45
- run: bundle exec rake spec
46
- - name: install dependencies for ${{ matrix.entry.name }}
47
- run: BUNDLE_GEMFILE=gemfiles/${{ matrix.entry.name }}.gemfile bundle install --jobs 3 --retry 3
48
- - name: test
49
- run: BUNDLE_GEMFILE=gemfiles/${{ matrix.entry.name }}.gemfile vendor/bats/bin/bats ${{ matrix.entry.bats }}
50
-
51
- # RSpec 2 doesn't work with Ruby 3.2:
52
- #
53
- # /opt/hostedtoolcache/Ruby/3.2.1/x64/lib/ruby/gems/3.2.0/gems/rspec-core-2.99.2/lib/rspec/core/ruby_project.rb:27:
54
- # in `block in find_first_parent_containing': undefined method `exists?' for File:Class (NoMethodError)
55
- #
56
- # ascend_until {|path| File.exists?(File.join(path, dir))}
57
- # ^^^^^^^^
58
- # Did you mean? exist?
59
- #
60
- # Up to Ruby 3.1 is the supported version for RSpec 2.
61
- rspec2:
62
- name: >-
63
- ${{ matrix.ruby }} ${{ matrix.entry.name }}
64
- runs-on: ${{ matrix.os }}-latest
65
- env:
66
- TEST_QUEUE_WORKERS: 2
67
- TEST_QUEUE_VERBOSE: 1
68
- strategy:
69
- fail-fast: false
70
- matrix:
71
- os: [ubuntu]
72
- # Lowest and Latest version.
73
- ruby: ['2.7', '3.1']
74
- entry:
75
- - { name: rspec2, bats: test/rspec2.bats }
76
-
77
- steps:
78
- - name: checkout
79
- uses: actions/checkout@v3
80
- - name: set up Ruby
81
- uses: ruby/setup-ruby@v1
82
- with:
83
- ruby-version: ${{ matrix.ruby }}
84
-
85
- - name: install dependencies
86
- run: bundle install --jobs 3 --retry 3
87
- - name: setup for Bats
88
- run: bundle exec rake setup
89
- - name: spec
90
- run: bundle exec rake spec
91
- - name: install dependencies for ${{ matrix.entry.name }}
92
- run: BUNDLE_GEMFILE=gemfiles/${{ matrix.entry.name }}.gemfile bundle install --jobs 3 --retry 3
93
- - name: test
94
- run: BUNDLE_GEMFILE=gemfiles/${{ matrix.entry.name }}.gemfile vendor/bats/bin/bats ${{ matrix.entry.bats }}
data/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- .test_queue_stats
2
- .ruby-version
3
- Gemfile.lock
4
- gemfiles/.bundle/
5
- *.gemfile.lock
6
- pkg
7
- vendor
data/Appraisals DELETED
@@ -1,43 +0,0 @@
1
- appraise "cucumber1-3" do
2
- gem 'cucumber', '~> 1.3.10'
3
- # Pin Rake version to Prevent `NoMethodError: undefined method `last_comment'`.
4
- gem 'rake', '< 11.0'
5
- end
6
-
7
- appraise "cucumber2-4" do
8
- gem 'cucumber', '~> 2.4.0'
9
- # Pin Rake version to Prevent `NoMethodError: undefined method `last_comment'`.
10
- gem 'rake', '< 11.0'
11
- end
12
-
13
- appraise "minitest4" do
14
- gem 'rake'
15
- gem 'minitest', '~> 4.7'
16
- end
17
-
18
- appraise "minitest5" do
19
- gem 'rake'
20
- gem 'minitest', '5.10.0'
21
- end
22
-
23
- appraise "rspec2" do
24
- # Pin Rake version to Prevent `NoMethodError: undefined method `last_comment'`.
25
- gem 'rake', '< 11.0'
26
- gem 'rspec', '~> 2.99'
27
- end
28
-
29
- appraise "rspec3" do
30
- gem 'rspec', '~> 3.12'
31
- end
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
-
41
- appraise "testunit" do
42
- gem 'test-unit'
43
- end
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- gem 'appraisal'
6
- gem 'rake'
7
- gem 'rspec', '>= 2.13', '< 4.0'
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => [:setup, :spec, :feature]
7
-
8
- task :setup do
9
- sh 'script/bootstrap' unless File.exist?("#{Dir.pwd}/vendor/bats/bin/bats")
10
- end
11
-
12
- task :feature do
13
- sh 'TEST_QUEUE_WORKERS=2 TEST_QUEUE_VERBOSE=1 vendor/bats/bin/bats test'
14
- end
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rake", "< 11.0"
6
- gem "rspec", ">= 2.13", "< 4.0"
7
- gem "cucumber", "~> 1.3.10"
8
-
9
- gemspec path: "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rake", "< 11.0"
6
- gem "rspec", ">= 2.13", "< 4.0"
7
- gem "cucumber", "~> 2.4.0"
8
-
9
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "minitest", "~> 4.7"
6
-
7
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "minitest", "5.10.0"
6
-
7
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rake", "< 11.0"
6
- gem "rspec", "~> 2.99"
7
-
8
- gemspec path: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rspec", "~> 3.12"
6
-
7
- gemspec path: "../"
@@ -1,11 +0,0 @@
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: "../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "test-unit"
6
-
7
- gemspec path: "../"
@@ -1,88 +0,0 @@
1
- require_relative '../runner'
2
- require 'set'
3
- require 'stringio'
4
-
5
- class MiniTestQueueRunner < MiniTest::Unit
6
- def _run_suites(suites, type)
7
- self.class.output = $stdout
8
-
9
- if defined?(ParallelEach)
10
- # Ignore its _run_suites implementation since we don't handle it gracefully.
11
- # If we don't do this #partition is called on the iterator and all suites
12
- # distributed immediately, instead of picked up as workers are available.
13
- suites.map { |suite| _run_suite suite, type }
14
- else
15
- super
16
- end
17
- end
18
-
19
- def _run_anything(*)
20
- ret = super
21
- output.puts
22
- ret
23
- end
24
-
25
- def _run_suite(suite, type)
26
- output.print ' '
27
- output.print suite
28
- output.print ': '
29
-
30
- start = Time.now
31
- ret = super
32
- diff = Time.now - start
33
-
34
- output.puts(" <%.3f>" % diff)
35
- ret
36
- end
37
-
38
- self.runner = self.new
39
- self.output = StringIO.new
40
- end
41
-
42
- class MiniTest::Unit::TestCase
43
- class << self
44
- attr_accessor :test_suites
45
-
46
- def original_test_suites
47
- @@test_suites.keys.reject{ |s| s.test_methods.empty? }
48
- end
49
- end
50
-
51
- def failure_count
52
- failures.length
53
- end
54
- end
55
-
56
- module TestQueue
57
- class Runner
58
- class MiniTest < Runner
59
- def initialize
60
- if ::MiniTest::Unit::TestCase.original_test_suites.any?
61
- fail "Do not `require` test files. Pass them via ARGV instead and they will be required as needed."
62
- end
63
- super(TestFramework::MiniTest.new)
64
- end
65
-
66
- def run_worker(iterator)
67
- ::MiniTest::Unit::TestCase.test_suites = iterator
68
- ::MiniTest::Unit.new.run
69
- end
70
- end
71
- end
72
-
73
- class TestFramework
74
- class MiniTest < TestFramework
75
- def all_suite_files
76
- ARGV
77
- end
78
-
79
- def suites_from_file(path)
80
- ::MiniTest::Unit::TestCase.reset
81
- require File.absolute_path(path)
82
- ::MiniTest::Unit::TestCase.original_test_suites.map { |suite|
83
- [suite.name, suite]
84
- }
85
- end
86
- end
87
- end
88
- end
@@ -1,44 +0,0 @@
1
- class ::RSpec::Core::ExampleGroup
2
- def self.failure_count
3
- examples.map {|e| e.execution_result[:status] == "failed"}.length
4
- end
5
- end
6
-
7
- module RSpec::Core
8
- class QueueRunner < CommandLine
9
- def initialize
10
- super(ARGV)
11
- @configuration.output_stream = $stdout
12
- @configuration.error_stream = $stderr
13
- end
14
-
15
- def run_each(iterator)
16
- @configuration.reporter.report(0, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
17
- begin
18
- @configuration.run_hook(:before, :suite)
19
- iterator.map {|g|
20
- if g.is_a? ::RSpec::Core::Example
21
- print " #{g.full_description}: "
22
- example = g
23
- g = example.example_group
24
- ::RSpec.world.filtered_examples.clear
25
- examples = [example]
26
- examples.extend(::RSpec::Core::Extensions::Ordered::Examples)
27
- ::RSpec.world.filtered_examples[g] = examples
28
- else
29
- print " #{g.description}: "
30
- end
31
- start = Time.now
32
- ret = g.run(reporter)
33
- diff = Time.now-start
34
- puts(" <%.3f>" % diff)
35
-
36
- ret
37
- }.all? ? 0 : @configuration.failure_exit_code
38
- ensure
39
- @configuration.run_hook(:after, :suite)
40
- end
41
- end
42
- end
43
- end
44
- end
data/script/bootstrap DELETED
@@ -1,13 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -ex
4
-
5
- cd "$(dirname "$0")/.."
6
- ROOT=$(pwd)
7
-
8
- rm -rf tmp
9
- mkdir tmp
10
- mkdir -p vendor/bats
11
- curl --silent --location --show-error https://github.com/sstephenson/bats/archive/v0.4.0.tar.gz | tar -xz -C tmp
12
- tmp/bats-0.4.0/install.sh "$ROOT/vendor/bats"
13
- rm -rf tmp
data/spec/stats_spec.rb DELETED
@@ -1,79 +0,0 @@
1
- require "fileutils"
2
- require "tempfile"
3
-
4
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
5
-
6
- require "test_queue/stats"
7
-
8
- RSpec.describe TestQueue::Stats do
9
- before do
10
- Tempfile.open("test_queue_stats") do |f|
11
- @path = f.path
12
- f.close!
13
- end
14
- end
15
-
16
- after do
17
- FileUtils.rm_f(@path)
18
- end
19
-
20
- describe "#initialize" do
21
- it "ignores empty stats files" do
22
- File.write(@path, "")
23
- stats = TestQueue::Stats.new(@path)
24
- expect(stats.all_suites).to be_empty
25
- end
26
-
27
- it "ignores invalid data in the stats files" do
28
- File.write(@path, "this is not marshal data")
29
- stats = TestQueue::Stats.new(@path)
30
- expect(stats.all_suites).to be_empty
31
- end
32
-
33
- it "ignores badly-typed data in the stats file" do
34
- File.write(@path, Marshal.dump(["heyyy"]))
35
- stats = TestQueue::Stats.new(@path)
36
- expect(stats.all_suites).to be_empty
37
- end
38
-
39
- it "ignores stats files with a wrong version number" do
40
- File.write(@path, Marshal.dump({ :version => 1e8, :suites => "boom" }))
41
- stats = TestQueue::Stats.new(@path)
42
- expect(stats.all_suites).to be_empty
43
- end
44
- end
45
-
46
- it "can save and load data" do
47
- stats = TestQueue::Stats.new(@path)
48
- time = truncated_now
49
- suites = [
50
- TestQueue::Stats::Suite.new("Suite1", "foo.rb", 0.3, time),
51
- TestQueue::Stats::Suite.new("Suite2", "bar.rb", 0.5, time + 5),
52
- ]
53
- stats.record_suites(suites)
54
- stats.save
55
-
56
- stats = TestQueue::Stats.new(@path)
57
- expect(stats.all_suites.sort_by(&:name)).to eq(suites)
58
- end
59
-
60
- it "prunes suites not seen in the last 8 days" do
61
- stats = TestQueue::Stats.new(@path)
62
- time = truncated_now
63
- suites = [
64
- TestQueue::Stats::Suite.new("Suite1", "foo.rb", 0.3, time),
65
- TestQueue::Stats::Suite.new("Suite2", "bar.rb", 0.5, time - (8 * 24 * 60 * 60) - 2),
66
- TestQueue::Stats::Suite.new("Suite3", "baz.rb", 0.6, time - (7 * 24 * 60 * 60)),
67
- ]
68
- stats.record_suites(suites)
69
- stats.save
70
-
71
- stats = TestQueue::Stats.new(@path)
72
- expect(stats.all_suites.map(&:name).sort).to eq(%w[Suite1 Suite3])
73
- end
74
-
75
- # Returns Time.now rounded down to the nearest second.
76
- def truncated_now
77
- Time.at(Time.now.to_i)
78
- end
79
- end
data/test/cucumber.bats DELETED
@@ -1,57 +0,0 @@
1
- load "testlib"
2
-
3
- SCRATCH=tmp/cucumber-tests
4
-
5
- setup() {
6
- require_gem "cucumber" ">= 1.0"
7
- rm -rf $SCRATCH
8
- mkdir -p $SCRATCH
9
- }
10
-
11
- teardown() {
12
- rm -rf $SCRATCH
13
- }
14
-
15
- @test "cucumber-queue succeeds when all features pass" {
16
- run bundle exec cucumber-queue test/samples/features --require test/samples/features/step_definitions
17
- assert_status 0
18
- assert_output_contains "Starting test-queue master"
19
- }
20
-
21
- @test "cucumber-queue fails when a feature fails" {
22
- export FAIL=1
23
- run bundle exec cucumber-queue test/samples/features --require test/samples/features/step_definitions
24
- assert_status 2
25
- assert_output_contains "Starting test-queue master"
26
- assert_output_contains "cucumber test/samples/features/bad.feature:2 # Scenario: failure"
27
- assert_output_contains "cucumber test/samples/features/sample2.feature:26 # Scenario: failure"
28
- }
29
-
30
- @test "cucumber-queue fails when given a missing feature" {
31
- run bundle exec cucumber-queue test/samples/does_not_exist.feature --require test/samples/features/step_definitions
32
- assert_status 1
33
- assert_output_contains "Aborting: Discovering suites failed."
34
- }
35
-
36
- @test "cucumber-queue fails when given a malformed feature" {
37
- [ -f README.md ]
38
- run bundle exec cucumber-queue README.md --require test/samples/features/step_definitions
39
-
40
- # Cucumber 1 and 2 fail in different ways.
41
- refute_status 0
42
- assert_output_matches 'Aborting: Discovering suites failed\.|README\.md: Parser errors:'
43
- }
44
-
45
- @test "cucumber-queue handles test file being deleted" {
46
- cp test/samples/features/*.feature $SCRATCH
47
-
48
- run bundle exec cucumber-queue $SCRATCH --require test/samples/features/step_definitions
49
- assert_status 0
50
- assert_output_matches "Feature: Foobar$"
51
-
52
- rm $SCRATCH/sample.feature
53
-
54
- run bundle exec cucumber-queue $SCRATCH --require test/samples/features/step_definitions
55
- assert_status 0
56
- refute_output_matches "Feature: Foobar$"
57
- }
data/test/minitest4.bats DELETED
@@ -1,34 +0,0 @@
1
- load "testlib"
2
-
3
- setup() {
4
- require_gem "minitest" "~> 4.0"
5
- }
6
-
7
- @test "minitest-queue succeeds when all tests pass" {
8
- run bundle exec minitest-queue ./test/samples/*_minitest4.rb
9
- assert_status 0
10
- assert_output_contains "Starting test-queue master"
11
- }
12
-
13
- @test "minitest-queue fails when a test fails" {
14
- export FAIL=1
15
- run bundle exec minitest-queue ./test/samples/*_minitest4.rb
16
- assert_status 1
17
- assert_output_contains "Starting test-queue master"
18
- assert_output_contains "1) Failure:"
19
- assert_output_contains "MiniTestFailure#test_fail"
20
- }
21
-
22
- @test "minitest-queue succeeds when all specs pass" {
23
- run bundle exec minitest-queue ./test/samples/*_minispec.rb
24
- assert_status 0
25
- assert_output_contains "Starting test-queue master"
26
- }
27
-
28
- @test "minitest-queue fails when a spec fails" {
29
- export FAIL=1
30
- run bundle exec minitest-queue ./test/samples/*_minispec.rb
31
- assert_status 1
32
- assert_output_contains "1) Failure:"
33
- assert_output_contains "Meme::when asked about blending possibilities#test_0002_fails"
34
- }