rspecq 0.2.0 → 0.2.1

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: 87f2cf8ea2c0b03bf491442902644d24dd001265b2550c0403073d3f34d99903
4
- data.tar.gz: 646b803ece2861f4ac8faced44f620ea5608636be38033f6931c0550bf4d79bd
3
+ metadata.gz: bd8d2265a817359a4de0336570aae613e6649c6ace1b19a08a73003775fa9d50
4
+ data.tar.gz: 25842da434b54e0a48946c51bbd18d910d2b1a8104c80e1cd6976092defa058d
5
5
  SHA512:
6
- metadata.gz: 418cf064a63ff4ea790495f578bb02f7c76ce6c0536af7a8fbdd8d6a293182f75cc15c587f2bcf798175f1ca0c427a208d8db326d157eacfcc199b783ce00d26
7
- data.tar.gz: c109a02fc2412f7bb412422d97ee8096d85795893904d7034bbf7928d9c4d8fc5492f279d3f8cfaa77a4065f2ec591ac23915a7d53c181340610c057558fa16f
6
+ metadata.gz: 1df57f05ceb5439da1afaf79092c87b735c897dd1f06ec7c7d072f7dfc44535ad1661f4966b1bc8d7916e6a92a6a5a4d95da2348a6a0453c325f527312cd5ffd
7
+ data.tar.gz: 36c3045ce31ddcc23923bd42859a91ff495b330fc058e4c82e0ab2feceeccd73d58dad4d6b90b77bbb35a657317303ba28f4af96cdaa7463547a173935942c80
@@ -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
@@ -2,7 +2,7 @@ require "rake/testtask"
2
2
 
3
3
  Rake::TestTask.new do |t|
4
4
  t.libs << "test"
5
- t.test_files = FileList['test/test*.rb']
5
+ t.test_files = FileList['test/test_*.rb']
6
6
  t.verbose = true
7
7
  end
8
8
 
@@ -0,0 +1,4 @@
1
+ RSpec Formatters are used by RSpecQ as hooks for various execution events.
2
+
3
+ For more info on formatters in general, see
4
+ https://rubydoc.info/gems/rspec-core/RSpec/Core/Formatters.
@@ -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]
@@ -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
- Raven.capture_message("Flaky jobs detected", level: "warning", extra: {
111
- build: @build_id,
112
- build_timeout: @timeout,
113
- queue: @queue.inspect,
114
- object: self.inspect,
115
- pid: Process.pid,
116
- flaky_jobs: jobs,
117
- flaky_jobs_count: jobs.count,
118
- build_duration: build_duration
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
@@ -1,3 +1,3 @@
1
1
  module RSpecQ
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.2.1".freeze
3
3
  end
@@ -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" (just like in RSpec)
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.0
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-08-31 00:00:00.000000000 Z
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