turbo_tests 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/snyk_ruby-analysis.yml +33 -0
- data/.gitignore +57 -0
- data/Gemfile.lock +7 -7
- data/README.md +6 -18
- data/lib/turbo_tests/cli.rb +1 -1
- data/lib/turbo_tests/json_rows_formatter.rb +41 -0
- data/lib/turbo_tests/reporter.rb +14 -2
- data/lib/turbo_tests/runner.rb +19 -2
- data/lib/turbo_tests/version.rb +1 -1
- data/lib/utils/hash_extension.rb +9 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92f70e0d1c7d01b5f9d17960ddcf2418c8c4fa620e8c46d0bb81df21b9193452
|
4
|
+
data.tar.gz: 0a21dd64949d53a8045e167754f19b698356f2a5c088f6ad56b83297d42932a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d0e28e448d9b3f6e8dc5f47ef6b6308d3a8a08ffdcdcacdddc20f979af2a1f6d7e0827afbe5cc1fd09293efa3abed703cf7c0082a5d5cc400dd32fb9c9672a0
|
7
|
+
data.tar.gz: 6efbeb21524f9973d759914766cf0966f4b3da0d0c68dab75c4efe0c412808df6a979324793ce3de21ff77745ca7f5bffda605f3a6e73635839e14e84b1d4658
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# A sample workflow which checks out your Infrastructure as Code Configuration files,
|
2
|
+
# such as Kubernetes, Helm & Terraform and scans them for any security issues.
|
3
|
+
# The results are then uploaded to GitHub Security Code Scanning
|
4
|
+
#
|
5
|
+
# For more examples, including how to limit scans to only high-severity issues
|
6
|
+
# and fail PR checks, see https://github.com/snyk/actions/
|
7
|
+
|
8
|
+
name: Snyk Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
# The branches below must be a subset of the branches above
|
15
|
+
branches: [ master ]
|
16
|
+
schedule:
|
17
|
+
- cron: '0 0 * * 0'
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
snyk:
|
21
|
+
runs-on: ubuntu-latest
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v2
|
24
|
+
- name: Run Snyk to check configuration files for security issues
|
25
|
+
# Snyk can be used to break the build when it detects security issues.
|
26
|
+
# In this case we want to upload the issues to GitHub Code Scanning
|
27
|
+
continue-on-error: true
|
28
|
+
uses: snyk/actions/ruby@master
|
29
|
+
env:
|
30
|
+
# In order to use the Snyk Action you will need to have a Snyk API token.
|
31
|
+
# More details in https://github.com/snyk/actions#getting-your-snyk-token
|
32
|
+
# or you can signup for free at https://snyk.io/login
|
33
|
+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
data/.gitignore
CHANGED
@@ -9,3 +9,60 @@
|
|
9
9
|
|
10
10
|
# rspec failure tracking
|
11
11
|
.rspec_status
|
12
|
+
|
13
|
+
|
14
|
+
# Created by https://www.toptal.com/developers/gitignore/api/macos,vim
|
15
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,vim
|
16
|
+
|
17
|
+
### macOS ###
|
18
|
+
# General
|
19
|
+
.DS_Store
|
20
|
+
.AppleDouble
|
21
|
+
.LSOverride
|
22
|
+
|
23
|
+
# Icon must end with two \r
|
24
|
+
Icon
|
25
|
+
|
26
|
+
|
27
|
+
# Thumbnails
|
28
|
+
._*
|
29
|
+
|
30
|
+
# Files that might appear in the root of a volume
|
31
|
+
.DocumentRevisions-V100
|
32
|
+
.fseventsd
|
33
|
+
.Spotlight-V100
|
34
|
+
.TemporaryItems
|
35
|
+
.Trashes
|
36
|
+
.VolumeIcon.icns
|
37
|
+
.com.apple.timemachine.donotpresent
|
38
|
+
|
39
|
+
# Directories potentially created on remote AFP share
|
40
|
+
.AppleDB
|
41
|
+
.AppleDesktop
|
42
|
+
Network Trash Folder
|
43
|
+
Temporary Items
|
44
|
+
.apdisk
|
45
|
+
|
46
|
+
### Vim ###
|
47
|
+
# Swap
|
48
|
+
[._]*.s[a-v][a-z]
|
49
|
+
!*.svg # comment out if you don't need vector files
|
50
|
+
[._]*.sw[a-p]
|
51
|
+
[._]s[a-rt-v][a-z]
|
52
|
+
[._]ss[a-gi-z]
|
53
|
+
[._]sw[a-p]
|
54
|
+
|
55
|
+
# Session
|
56
|
+
Session.vim
|
57
|
+
Sessionx.vim
|
58
|
+
|
59
|
+
# Temporary
|
60
|
+
.netrwhist
|
61
|
+
*~
|
62
|
+
# Auto-generated tag files
|
63
|
+
tags
|
64
|
+
# Persistent undo
|
65
|
+
[._]*.un~
|
66
|
+
|
67
|
+
# End of https://www.toptal.com/developers/gitignore/api/macos,vim
|
68
|
+
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
turbo_tests (1.2.
|
4
|
+
turbo_tests (1.2.2)
|
5
5
|
bundler
|
6
6
|
parallel_tests (~> 3.3)
|
7
7
|
rspec (~> 3.10.0)
|
@@ -13,9 +13,9 @@ GEM
|
|
13
13
|
diff-lcs (1.4.4)
|
14
14
|
method_source (1.0.0)
|
15
15
|
parallel (1.20.1)
|
16
|
-
parallel_tests (3.
|
16
|
+
parallel_tests (3.5.0)
|
17
17
|
parallel
|
18
|
-
pry (0.
|
18
|
+
pry (0.14.0)
|
19
19
|
coderay (~> 1.1)
|
20
20
|
method_source (~> 1.0)
|
21
21
|
rake (12.3.3)
|
@@ -23,15 +23,15 @@ GEM
|
|
23
23
|
rspec-core (~> 3.10.0)
|
24
24
|
rspec-expectations (~> 3.10.0)
|
25
25
|
rspec-mocks (~> 3.10.0)
|
26
|
-
rspec-core (3.10.
|
26
|
+
rspec-core (3.10.1)
|
27
27
|
rspec-support (~> 3.10.0)
|
28
|
-
rspec-expectations (3.10.
|
28
|
+
rspec-expectations (3.10.1)
|
29
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
30
|
rspec-support (~> 3.10.0)
|
31
|
-
rspec-mocks (3.10.
|
31
|
+
rspec-mocks (3.10.2)
|
32
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
33
|
rspec-support (~> 3.10.0)
|
34
|
-
rspec-support (3.10.
|
34
|
+
rspec-support (3.10.2)
|
35
35
|
|
36
36
|
PLATFORMS
|
37
37
|
ruby
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
![Tests](https://github.com/serpapi/turbo_tests/workflows/Tests/badge.svg)
|
2
|
+
|
1
3
|
# TurboTests
|
2
4
|
|
3
5
|
Runner for [`grosser/parallel_tests`](https://github.com/grosser/parallel_tests) with incremental summarized output. Based on [Discourse](https://github.com/discourse/discourse/blob/6b9784cf8a18636bce281a7e4d18e65a0cbc6290/lib/turbo_tests.rb) and [RubyGems](https://github.com/rubygems/rubygems/tree/390335ceb351668cd433bd5bb9823dd021f82533/bundler/tool) work in this area.
|
@@ -11,23 +13,17 @@ This feature [doesn't fit vision of `parallel_tests` author](https://github.com/
|
|
11
13
|
```bash
|
12
14
|
|
13
15
|
$ bundle exec rake parallel_tests:spec[^spec/search]
|
14
|
-
|
15
|
-
...........................................................................................................................................................................................
|
16
|
-
...........................................................................................................................................................................................
|
16
|
+
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
|
17
17
|
|
18
18
|
Finished in 1 minute 6.92 seconds (files took 6.95 seconds to load)
|
19
19
|
2616 examples, 0 failures
|
20
20
|
|
21
|
-
.........................................................................................................................................F
|
22
|
-
.......................................................................................F...................................................................................................
|
23
|
-
...........................................................................................................................................................................................
|
21
|
+
.........................................................................................................................................F........................................................................................................................................F..............................................................................................................................................................................................................................................................................................
|
24
22
|
|
25
23
|
Finished in 1 minute 35.05 seconds (files took 6.26 seconds to load)
|
26
24
|
2158 examples, 2 failures
|
27
25
|
|
28
|
-
|
29
|
-
...........................................................................................................................................................................................
|
30
|
-
...........................................................................................................................................................................................
|
26
|
+
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
|
31
27
|
|
32
28
|
Finished in 1 minute 35.05 seconds (files took 6.26 seconds to load)
|
33
29
|
2158 examples, 0 failures
|
@@ -37,15 +33,7 @@ Finished in 1 minute 35.05 seconds (files took 6.26 seconds to load)
|
|
37
33
|
|
38
34
|
```bash
|
39
35
|
$ bundle exec turbo_tests
|
40
|
-
|
41
|
-
...........................................................................................................................................................................................
|
42
|
-
...........................................................................................................................................................................................
|
43
|
-
.........................................................................................................................................F.................................................
|
44
|
-
.......................................................................................F...................................................................................................
|
45
|
-
...........................................................................................................................................................................................
|
46
|
-
...........................................................................................................................................................................................
|
47
|
-
...........................................................................................................................................................................................
|
48
|
-
...........................................................................................................................................................................................
|
36
|
+
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F........................................................................................................................................F..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
|
49
37
|
|
50
38
|
Finished in 2 minute 25.15 seconds (files took 0 seconds to load)
|
51
39
|
6873 examples, 2 failures
|
data/lib/turbo_tests/cli.rb
CHANGED
@@ -17,7 +17,7 @@ module TurboTests
|
|
17
17
|
fail_fast = nil
|
18
18
|
|
19
19
|
OptionParser.new { |opts|
|
20
|
-
opts.banner =
|
20
|
+
opts.banner = <<~BANNER
|
21
21
|
Run all tests in parallel, giving each process ENV['TEST_ENV_NUMBER'] ('1', '2', '3', ...).
|
22
22
|
|
23
23
|
Uses parallel_tests under the hood, but reports test results incrementally. Based on Discourse and RubyGems work in this area.
|
@@ -22,10 +22,14 @@ module TurboTests
|
|
22
22
|
class JsonRowsFormatter
|
23
23
|
RSpec::Core::Formatters.register(
|
24
24
|
self,
|
25
|
+
:start,
|
25
26
|
:close,
|
26
27
|
:example_failed,
|
27
28
|
:example_passed,
|
28
29
|
:example_pending,
|
30
|
+
:example_group_started,
|
31
|
+
:example_group_finished,
|
32
|
+
:example_pending,
|
29
33
|
:seed
|
30
34
|
)
|
31
35
|
|
@@ -35,6 +39,28 @@ module TurboTests
|
|
35
39
|
@output = output
|
36
40
|
end
|
37
41
|
|
42
|
+
|
43
|
+
def start(notification)
|
44
|
+
output_row(
|
45
|
+
"type" => :load_summary,
|
46
|
+
"summary" => load_summary_to_json(notification)
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def example_group_started(notification)
|
51
|
+
output_row(
|
52
|
+
"type" => :group_started,
|
53
|
+
"group" => group_to_json(notification)
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def example_group_finished(notification)
|
58
|
+
output_row(
|
59
|
+
"type" => :group_finished,
|
60
|
+
"group" => group_to_json(notification)
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
38
64
|
def example_passed(notification)
|
39
65
|
output_row(
|
40
66
|
"type" => :example_passed,
|
@@ -113,6 +139,21 @@ module TurboTests
|
|
113
139
|
}
|
114
140
|
end
|
115
141
|
|
142
|
+
def load_summary_to_json(notification)
|
143
|
+
{
|
144
|
+
count: notification.count,
|
145
|
+
load_time: notification.load_time
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
149
|
+
def group_to_json(notification)
|
150
|
+
{
|
151
|
+
"group": {
|
152
|
+
"description": notification.group.description
|
153
|
+
}
|
154
|
+
}
|
155
|
+
end
|
156
|
+
|
116
157
|
def output_row(obj)
|
117
158
|
output.puts ENV["RSPEC_FORMATTER_OUTPUT_ID"] + obj.to_json
|
118
159
|
end
|
data/lib/turbo_tests/reporter.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module TurboTests
|
4
4
|
class Reporter
|
5
|
+
attr_writer :load_time
|
6
|
+
|
5
7
|
def self.from_config(formatter_config, start_time)
|
6
8
|
reporter = new(start_time)
|
7
9
|
|
@@ -27,6 +29,7 @@ module TurboTests
|
|
27
29
|
@failed_examples = []
|
28
30
|
@all_examples = []
|
29
31
|
@start_time = start_time
|
32
|
+
@load_time = 0
|
30
33
|
end
|
31
34
|
|
32
35
|
def add(name, outputs)
|
@@ -45,6 +48,14 @@ module TurboTests
|
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
51
|
+
def group_started(notification)
|
52
|
+
delegate_to_formatters(:example_group_started, notification)
|
53
|
+
end
|
54
|
+
|
55
|
+
def group_finished
|
56
|
+
delegate_to_formatters(:example_group_finished, nil)
|
57
|
+
end
|
58
|
+
|
48
59
|
def example_passed(example)
|
49
60
|
delegate_to_formatters(:example_passed, example.notification)
|
50
61
|
|
@@ -66,7 +77,8 @@ module TurboTests
|
|
66
77
|
end
|
67
78
|
|
68
79
|
def finish
|
69
|
-
|
80
|
+
# SEE: https://bit.ly/2NP87Cz
|
81
|
+
end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
70
82
|
|
71
83
|
delegate_to_formatters(:start_dump,
|
72
84
|
RSpec::Core::Notifications::NullNotification)
|
@@ -84,7 +96,7 @@ module TurboTests
|
|
84
96
|
@all_examples,
|
85
97
|
@failed_examples,
|
86
98
|
@pending_examples,
|
87
|
-
|
99
|
+
@load_time,
|
88
100
|
0
|
89
101
|
))
|
90
102
|
delegate_to_formatters(:close,
|
data/lib/turbo_tests/runner.rb
CHANGED
@@ -3,13 +3,19 @@
|
|
3
3
|
require "json"
|
4
4
|
require "parallel_tests/rspec/runner"
|
5
5
|
|
6
|
+
require_relative "../utils/hash_extension"
|
7
|
+
|
6
8
|
module TurboTests
|
7
9
|
class Runner
|
10
|
+
using CoreExtensions
|
11
|
+
|
8
12
|
def self.run(opts = {})
|
9
13
|
files = opts[:files]
|
10
14
|
formatters = opts[:formatters]
|
11
15
|
tags = opts[:tags]
|
12
|
-
|
16
|
+
|
17
|
+
# SEE: https://bit.ly/2NP87Cz
|
18
|
+
start_time = opts.fetch(:start_time) { Process.clock_gettime(Process::CLOCK_MONOTONIC) }
|
13
19
|
verbose = opts.fetch(:verbose, false)
|
14
20
|
fail_fast = opts.fetch(:fail_fast, nil)
|
15
21
|
count = opts.fetch(:count, nil)
|
@@ -33,6 +39,8 @@ module TurboTests
|
|
33
39
|
@verbose = opts[:verbose]
|
34
40
|
@fail_fast = opts[:fail_fast]
|
35
41
|
@count = opts[:count]
|
42
|
+
@load_time = 0
|
43
|
+
@load_count = 0
|
36
44
|
|
37
45
|
@failure_count = 0
|
38
46
|
@runtime_log = "tmp/parallel_runtime_rspec.log"
|
@@ -157,9 +165,18 @@ module TurboTests
|
|
157
165
|
when "example_passed"
|
158
166
|
example = FakeExample.from_obj(message["example"])
|
159
167
|
@reporter.example_passed(example)
|
168
|
+
when "group_started"
|
169
|
+
@reporter.group_started(message["group"].to_struct)
|
170
|
+
when "group_finished"
|
171
|
+
@reporter.group_finished
|
160
172
|
when "example_pending"
|
161
173
|
example = FakeExample.from_obj(message["example"])
|
162
174
|
@reporter.example_pending(example)
|
175
|
+
when "load_summary"
|
176
|
+
message = message["summary"]
|
177
|
+
# NOTE: notifications order and content is not guaranteed hence the fetch
|
178
|
+
# and count increment tracking to get the latest accumulated load time
|
179
|
+
@reporter.load_time = message["load_time"] if message.fetch("count", 0) > @load_count
|
163
180
|
when "example_failed"
|
164
181
|
example = FakeExample.from_obj(message["example"])
|
165
182
|
@reporter.example_failed(example)
|
@@ -193,7 +210,7 @@ module TurboTests
|
|
193
210
|
|
194
211
|
num_processes = groups.size
|
195
212
|
num_tests = groups.map(&:size).sum
|
196
|
-
tests_per_process = (num_processes == 0 ? 0 : num_tests / num_processes)
|
213
|
+
tests_per_process = (num_processes == 0 ? 0 : num_tests.to_f / num_processes).round
|
197
214
|
|
198
215
|
puts "#{num_processes} processes for #{num_tests} #{name}s, ~ #{tests_per_process} #{name}s per process"
|
199
216
|
end
|
data/lib/turbo_tests/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Zub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -74,6 +74,7 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- ".github/workflows/snyk_ruby-analysis.yml"
|
77
78
|
- ".github/workflows/tests.yml"
|
78
79
|
- ".gitignore"
|
79
80
|
- ".rspec"
|
@@ -91,6 +92,7 @@ files:
|
|
91
92
|
- lib/turbo_tests/reporter.rb
|
92
93
|
- lib/turbo_tests/runner.rb
|
93
94
|
- lib/turbo_tests/version.rb
|
95
|
+
- lib/utils/hash_extension.rb
|
94
96
|
- turbo_tests.gemspec
|
95
97
|
homepage: https://github.com/serpapi/turbo_tests
|
96
98
|
licenses:
|