rspecq 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Rakefile +1 -1
- data/lib/rspecq/formatters/README.md +4 -0
- data/lib/rspecq/queue.rb +11 -0
- data/lib/rspecq/reporter.rb +34 -10
- data/lib/rspecq/version.rb +1 -1
- data/lib/rspecq/worker.rb +12 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd8d2265a817359a4de0336570aae613e6649c6ace1b19a08a73003775fa9d50
|
4
|
+
data.tar.gz: 25842da434b54e0a48946c51bbd18d910d2b1a8104c80e1cd6976092defa058d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1df57f05ceb5439da1afaf79092c87b735c897dd1f06ec7c7d072f7dfc44535ad1661f4966b1bc8d7916e6a92a6a5a4d95da2348a6a0453c325f527312cd5ffd
|
7
|
+
data.tar.gz: 36c3045ce31ddcc23923bd42859a91ff495b330fc058e4c82e0ab2feceeccd73d58dad4d6b90b77bbb35a657317303ba28f4af96cdaa7463547a173935942c80
|
data/CHANGELOG.md
CHANGED
@@ -5,9 +5,19 @@ Breaking changes are prefixed with a "[BREAKING]" label.
|
|
5
5
|
## master (unreleased)
|
6
6
|
|
7
7
|
|
8
|
+
## 0.2.1 (2020-09-09)
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Sentry Integration: Changed the way events for flaky jobs are emitted to a
|
13
|
+
per-flaky-job fashion. This ultimately improves grouping and filtering of the
|
14
|
+
flaky events in Sentry [[#33](https://github.com/skroutz/rspecq/pull/33)]
|
15
|
+
|
8
16
|
|
9
17
|
## 0.2.0 (2020-08-31)
|
10
18
|
|
19
|
+
This is a feature release with no breaking changes.
|
20
|
+
|
11
21
|
### Added
|
12
22
|
|
13
23
|
- Flaky jobs are now printed by the reporter in the final build output and also
|
data/Rakefile
CHANGED
data/lib/rspecq/queue.rb
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
require "redis"
|
2
2
|
|
3
3
|
module RSpecQ
|
4
|
+
# Queue is the data store interface (Redis) and is used to manage the work
|
5
|
+
# queue for a particular build. All Redis operations happen via Queue.
|
6
|
+
#
|
7
|
+
# A queue typically contains all the data needed for a particular build to
|
8
|
+
# happen. These include (but are not limited to) the following:
|
9
|
+
#
|
10
|
+
# - the list of jobs (spec files and/or examples) to be executed
|
11
|
+
# - the failed examples along with their backtrace
|
12
|
+
# - the set of running jobs
|
13
|
+
# - previous job timing statistics used to optimally schedule the jobs
|
14
|
+
# - the set of executed jobs
|
4
15
|
class Queue
|
5
16
|
RESERVE_JOB = <<~LUA.freeze
|
6
17
|
local queue = KEYS[1]
|
data/lib/rspecq/reporter.rb
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
module RSpecQ
|
2
|
+
# A Reporter, given a build ID, is responsible for consolidating the results
|
3
|
+
# from different workers and printing a complete build summary to the user,
|
4
|
+
# along with any failures that might have occured.
|
5
|
+
#
|
6
|
+
# The failures are printed in real-time as they occur, while the final
|
7
|
+
# summary is printed after the queue is empty and no tests are being
|
8
|
+
# executed. If the build failed, the status code of the reporter is non-zero.
|
9
|
+
#
|
10
|
+
# Reporters are readers of the queue.
|
2
11
|
class Reporter
|
3
12
|
def initialize(build_id:, timeout:, redis_host:)
|
4
13
|
@build_id = build_id
|
@@ -107,16 +116,31 @@ module RSpecQ
|
|
107
116
|
def flaky_jobs_to_sentry(jobs, build_duration)
|
108
117
|
return if jobs.empty?
|
109
118
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
119
|
+
jobs.each do |job|
|
120
|
+
filename = job.sub(/\[.+\]/, '')
|
121
|
+
|
122
|
+
extra = {
|
123
|
+
build: @build_id,
|
124
|
+
build_timeout: @timeout,
|
125
|
+
queue: @queue.inspect,
|
126
|
+
object: self.inspect,
|
127
|
+
pid: Process.pid,
|
128
|
+
job_path: job,
|
129
|
+
build_duration: build_duration
|
130
|
+
}
|
131
|
+
|
132
|
+
tags = {
|
133
|
+
flaky: true,
|
134
|
+
spec_file: filename
|
135
|
+
}
|
136
|
+
|
137
|
+
Raven.capture_message(
|
138
|
+
"Flaky test in #{filename}",
|
139
|
+
level: 'warning',
|
140
|
+
extra: extra,
|
141
|
+
tags: tags
|
142
|
+
)
|
143
|
+
end
|
120
144
|
end
|
121
145
|
end
|
122
146
|
end
|
data/lib/rspecq/version.rb
CHANGED
data/lib/rspecq/worker.rb
CHANGED
@@ -3,12 +3,23 @@ require "pathname"
|
|
3
3
|
require "pp"
|
4
4
|
|
5
5
|
module RSpecQ
|
6
|
+
# A Worker, given a build ID, continuously consumes tests off the
|
7
|
+
# corresponding and executes them, until the queue is empty.
|
8
|
+
# It is also responsible for populating the initial queue.
|
9
|
+
#
|
10
|
+
# Essentially, a worker is an RSpec runner that prints the results of the
|
11
|
+
# tests it executes to standard output.
|
12
|
+
#
|
13
|
+
# The typical use case is to spawn many workers for a given build, thereby
|
14
|
+
# parallelizing the work and achieving faster build times.
|
15
|
+
#
|
16
|
+
# Workers are readers+writers of the queue.
|
6
17
|
class Worker
|
7
18
|
HEARTBEAT_FREQUENCY = WORKER_LIVENESS_SEC / 6
|
8
19
|
|
9
20
|
# The root path or individual spec files to execute.
|
10
21
|
#
|
11
|
-
# Defaults to "spec" (
|
22
|
+
# Defaults to "spec" (similar to RSpec)
|
12
23
|
attr_accessor :files_or_dirs_to_run
|
13
24
|
|
14
25
|
# If true, job timings will be populated in the global Redis timings key
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspecq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agis Anastasopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- Rakefile
|
122
122
|
- bin/rspecq
|
123
123
|
- lib/rspecq.rb
|
124
|
+
- lib/rspecq/formatters/README.md
|
124
125
|
- lib/rspecq/formatters/example_count_recorder.rb
|
125
126
|
- lib/rspecq/formatters/failure_recorder.rb
|
126
127
|
- lib/rspecq/formatters/job_timing_recorder.rb
|