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.
- checksums.yaml +4 -4
- data/README.md +42 -42
- data/exe/cucumber-queue +2 -1
- data/exe/minitest-queue +3 -2
- data/exe/rspec-queue +2 -1
- data/exe/testunit-queue +2 -1
- data/lib/test-queue.rb +2 -0
- data/lib/test_queue/iterator.rb +22 -14
- data/lib/test_queue/runner/cucumber.rb +3 -0
- data/lib/test_queue/runner/{sample.rb → example.rb} +30 -9
- data/lib/test_queue/runner/minitest.rb +5 -3
- data/lib/test_queue/runner/minitest4.rb +12 -7
- data/lib/test_queue/runner/minitest5.rb +37 -22
- data/lib/test_queue/runner/puppet_lint.rb +6 -4
- data/lib/test_queue/runner/rspec.rb +14 -3
- data/lib/test_queue/runner/rspec2.rb +24 -24
- data/lib/test_queue/runner/rspec3.rb +11 -11
- data/lib/test_queue/runner/testunit.rb +6 -3
- data/lib/test_queue/runner.rb +87 -97
- data/lib/test_queue/stats.rb +17 -13
- data/lib/test_queue/test_framework.rb +2 -0
- data/lib/test_queue/version.rb +5 -0
- data/lib/test_queue.rb +1 -5
- metadata +7 -44
- data/.github/workflows/test.yml +0 -94
- data/.gitignore +0 -7
- data/Appraisals +0 -43
- data/Gemfile +0 -7
- data/Rakefile +0 -14
- data/gemfiles/cucumber1_3.gemfile +0 -9
- data/gemfiles/cucumber2_4.gemfile +0 -9
- data/gemfiles/minitest4.gemfile +0 -7
- data/gemfiles/minitest5.gemfile +0 -7
- data/gemfiles/rspec2.gemfile +0 -8
- data/gemfiles/rspec3.gemfile +0 -7
- data/gemfiles/rspec4.gemfile +0 -11
- data/gemfiles/testunit.gemfile +0 -7
- data/script/bootstrap +0 -13
- data/spec/stats_spec.rb +0 -79
- data/test/cucumber.bats +0 -57
- data/test/minitest4.bats +0 -34
- data/test/minitest5.bats +0 -194
- data/test/rspec2.bats +0 -46
- data/test/rspec3.bats +0 -56
- data/test/rspec4.bats +0 -56
- data/test/samples/features/bad.feature +0 -5
- data/test/samples/features/sample.feature +0 -25
- data/test/samples/features/sample2.feature +0 -29
- data/test/samples/features/step_definitions/common.rb +0 -19
- data/test/samples/sample_minispec.rb +0 -37
- data/test/samples/sample_minitest4.rb +0 -25
- data/test/samples/sample_minitest5.rb +0 -33
- data/test/samples/sample_rspec_helper.rb +0 -1
- data/test/samples/sample_shared_examples_for_spec.rb +0 -3
- data/test/samples/sample_spec.rb +0 -25
- data/test/samples/sample_split_spec.rb +0 -17
- data/test/samples/sample_testunit.rb +0 -25
- data/test/samples/sample_use_shared_example1_spec.rb +0 -7
- data/test/samples/sample_use_shared_example2_spec.rb +0 -7
- data/test/sleepy_runner.rb +0 -16
- data/test/testlib.bash +0 -89
- data/test/testunit.bats +0 -20
- data/test-queue.gemspec +0 -21
data/lib/test_queue/stats.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module TestQueue
|
2
4
|
class Stats
|
3
5
|
class Suite
|
@@ -19,17 +21,17 @@ module TestQueue
|
|
19
21
|
duration == other.duration &&
|
20
22
|
last_seen_at == other.last_seen_at
|
21
23
|
end
|
22
|
-
|
24
|
+
alias eql? ==
|
23
25
|
|
24
26
|
def to_h
|
25
|
-
{ :
|
27
|
+
{ name: name, path: path, duration: duration, last_seen_at: last_seen_at.to_i }
|
26
28
|
end
|
27
29
|
|
28
30
|
def self.from_hash(hash)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
new(hash.fetch(:name),
|
32
|
+
hash.fetch(:path),
|
33
|
+
hash.fetch(:duration),
|
34
|
+
Time.at(hash.fetch(:last_seen_at)))
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
@@ -56,7 +58,7 @@ module TestQueue
|
|
56
58
|
def save
|
57
59
|
prune
|
58
60
|
|
59
|
-
File.open(@path,
|
61
|
+
File.open(@path, 'wb') do |f|
|
60
62
|
Marshal.dump(to_h, f)
|
61
63
|
end
|
62
64
|
end
|
@@ -68,15 +70,17 @@ module TestQueue
|
|
68
70
|
def to_h
|
69
71
|
suites = @suites.each_value.map(&:to_h)
|
70
72
|
|
71
|
-
{ :
|
73
|
+
{ version: CURRENT_VERSION, suites: suites }
|
72
74
|
end
|
73
75
|
|
74
76
|
def load
|
75
77
|
data = begin
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
File.open(@path, 'rb') { |f| Marshal.load(f) }
|
79
|
+
rescue Errno::ENOENT, EOFError, TypeError, ArgumentError
|
80
|
+
# noop
|
81
|
+
end
|
82
|
+
return unless data.is_a?(Hash) && data[:version] == CURRENT_VERSION
|
83
|
+
|
80
84
|
data[:suites].each do |suite_hash|
|
81
85
|
suite = Suite.from_hash(suite_hash)
|
82
86
|
@suites[suite.name] = suite
|
@@ -87,7 +91,7 @@ module TestQueue
|
|
87
91
|
|
88
92
|
def prune
|
89
93
|
earliest = Time.now - EIGHT_DAYS_S
|
90
|
-
@suites.delete_if do |
|
94
|
+
@suites.delete_if do |_name, suite|
|
91
95
|
suite.last_seen_at < earliest
|
92
96
|
end
|
93
97
|
end
|
data/lib/test_queue.rb
CHANGED
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.
|
4
|
+
version: 0.8.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-
|
11
|
+
date: 2023-05-07 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,30 +20,18 @@ 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
36
|
- lib/test_queue/runner/minitest4.rb
|
49
37
|
- lib/test_queue/runner/minitest5.rb
|
@@ -51,40 +39,15 @@ files:
|
|
51
39
|
- lib/test_queue/runner/rspec.rb
|
52
40
|
- lib/test_queue/runner/rspec2.rb
|
53
41
|
- lib/test_queue/runner/rspec3.rb
|
54
|
-
- lib/test_queue/runner/sample.rb
|
55
42
|
- lib/test_queue/runner/testunit.rb
|
56
43
|
- lib/test_queue/stats.rb
|
57
44
|
- lib/test_queue/test_framework.rb
|
58
|
-
-
|
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
|
45
|
+
- lib/test_queue/version.rb
|
84
46
|
homepage: https://github.com/tmm1/test-queue
|
85
47
|
licenses:
|
86
48
|
- MIT
|
87
|
-
metadata:
|
49
|
+
metadata:
|
50
|
+
rubygems_mfa_required: 'true'
|
88
51
|
post_install_message:
|
89
52
|
rdoc_options: []
|
90
53
|
require_paths:
|
@@ -100,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
63
|
- !ruby/object:Gem::Version
|
101
64
|
version: '0'
|
102
65
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
66
|
+
rubygems_version: 3.4.10
|
104
67
|
signing_key:
|
105
68
|
specification_version: 4
|
106
69
|
summary: parallel test runner
|
data/.github/workflows/test.yml
DELETED
@@ -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
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
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
|
data/gemfiles/minitest4.gemfile
DELETED
data/gemfiles/minitest5.gemfile
DELETED
data/gemfiles/rspec2.gemfile
DELETED
data/gemfiles/rspec3.gemfile
DELETED
data/gemfiles/rspec4.gemfile
DELETED
@@ -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: "../"
|
data/gemfiles/testunit.gemfile
DELETED
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
|
-
}
|