specjour 2.0.0.rc2 → 2.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25c6007ab5a18e0e75c6b75121fe1c4a1c08792e
4
- data.tar.gz: b754110e3ba182341e0cf88fc3a9b0aeb7c76ed6
3
+ metadata.gz: 18afbf7019ee84aeaa6eaa20f523d38c9e3f67c5
4
+ data.tar.gz: 5c190741ea65714a23579692ec30bc28bd0c5dcb
5
5
  SHA512:
6
- metadata.gz: f46ab3c33f34934a834adc13fd4a8b0c76f4bf1840c7beb2ec266310328d7fea663a5ec99489628d4f757733cd04c735e3deaeab6e3f877cf2ec73d976dfdca6
7
- data.tar.gz: 3d26b413944d6c04bfb5615db696bc197ef15ee6d3b1a130340cc8990b8085b6a67700f5be0da48ea73f4b40739087e6277a2996a580ad0a8da4961788d6d1c9
6
+ metadata.gz: 1da69aec4f91b7caeda8c5bb80877dda5c712b9906d7f352433f8d214964ab17b9e5d6a2c7c7c922ca2a9bb2f0bae1527853fb619d0f46c9a15fd90f12a341ca
7
+ data.tar.gz: 51a9464cabf12348591e919b5b298cd798daef7d5ee9eb4ecba5c0543f622a8f4fea9c00385c410f7faac3fb205895a61842722fb8ad3e04dfe36017dafad618
@@ -30,10 +30,9 @@ module Specjour
30
30
  autoload :SocketHelper, 'specjour/socket_helper'
31
31
  autoload :Worker, 'specjour/worker'
32
32
 
33
- autoload :Cucumber, 'specjour/cucumber'
34
33
  autoload :RSpec, 'specjour/rspec'
35
34
 
36
- VERSION ||= "2.0.0.rc2"
35
+ VERSION ||= "2.0.0.rc3"
37
36
  HOOKS_PATH ||= "./.specjour/hooks.rb"
38
37
  PROGRAM_NAME ||= $PROGRAM_NAME # keep a reference of the original program name
39
38
  Time = Time.dup
@@ -3,7 +3,7 @@ module Specjour
3
3
  include Colors
4
4
  # description, status [pending,failed,passed] file_path, line_number, exception => [class, message, backtrace]
5
5
 
6
- STATUSES = Hash.new({char: "?", color: :white}).merge!(
6
+ STATUSES = Hash.new({char: "?", color: :cyan}).merge!(
7
7
  "passed" => {char: ".", color: :green},
8
8
  "failed" => {char: "F", color: :red},
9
9
  "error" => {char: "E", color: :magenta},
@@ -119,6 +119,13 @@ module Specjour
119
119
  end
120
120
  end
121
121
 
122
+ def report_error(message)
123
+ @error_count += 1
124
+ status_format = STATUSES["error"]
125
+ @output.print colorize(status_format[:char], status_format[:color])
126
+ @output.puts "\n#{message}\n"
127
+ end
128
+
122
129
  def set_end_time!
123
130
  @end_time = Time.now
124
131
  end
@@ -144,7 +144,7 @@ module Specjour
144
144
 
145
145
  def start
146
146
  $PROGRAM_NAME = program_name
147
- log "Listener starting"
147
+ log "Listener starting pid: #{Process.pid} grp: #{Process.getpgrp} ppid: #{Process.ppid}"
148
148
  write_pid
149
149
  loop do
150
150
  log "listening..."
@@ -167,7 +167,16 @@ module Specjour
167
167
  end
168
168
 
169
169
  def started?
170
- !pid.nil?
170
+ process_id = pid
171
+ if process_id
172
+ begin
173
+ Process.getsid(process_id) && true
174
+ rescue Errno::ESRCH
175
+ false
176
+ end
177
+ else
178
+ false
179
+ end
171
180
  end
172
181
 
173
182
  def stop
@@ -20,6 +20,7 @@ module Specjour
20
20
  def start
21
21
  Process.setsid
22
22
  $PROGRAM_NAME = "specjour loader"
23
+ debug "Loader pid: #{Process.pid} ppid: #{Process.ppid}"
23
24
  set_up
24
25
  sync
25
26
  Specjour.plugin_manager.send_task(:load_application)
@@ -31,9 +32,10 @@ module Specjour
31
32
  $stderr.puts e.backtrace
32
33
  $stderr.puts "\n\n"
33
34
  connection.error(e)
35
+ remove_connection
36
+ kill_parent
34
37
  ensure
35
38
  remove_connection
36
- log "Loader killing group #{Process.getsid}"
37
39
  end
38
40
 
39
41
  def fork_workers
@@ -59,12 +61,22 @@ module Specjour
59
61
  signal = connection.get_server_done
60
62
  case signal
61
63
  when "INT"
62
- debug "Sending INT to -#{Process.getsid}"
63
- Process.kill("INT", -Process.getsid)
64
+ kill_session
64
65
  end
65
66
  end
66
67
  end
67
68
 
69
+ def kill_session
70
+ debug "Sending INT to session -#{Process.getsid}"
71
+ Process.kill("INT", -Process.getsid) rescue nil
72
+ end
73
+
74
+ # shut down the parent before it restarts this loader in a loop
75
+ def kill_parent
76
+ debug "Sending INT to parent -#{Process.ppid}"
77
+ Process.kill("INT", Process.ppid) rescue nil
78
+ end
79
+
68
80
  def set_up
69
81
  data = connection.ready({hostname: hostname, worker_size: Specjour.configuration.worker_size})
70
82
  Specjour.configuration.project_name = data[:project_name]
@@ -17,7 +17,7 @@ module Specjour
17
17
  @clients = {}
18
18
  @tests_to_run = []
19
19
  @test_paths = options[:test_paths]
20
- @example_size = 0
20
+ @example_size = nil
21
21
  @machines = []
22
22
  @send_threads = []
23
23
  @bonjour_service = nil
@@ -89,7 +89,7 @@ module Specjour
89
89
  reads = result.first
90
90
  reads.each do |socket_being_read|
91
91
  if socket_being_read == @server_socket
92
- debug "adding connection"
92
+ debug "adding connection #{@send_threads.size}"
93
93
  client_socket = @server_socket.accept
94
94
  client_socket = Connection.wrap(client_socket)
95
95
  @send_threads << Thread.new(client_socket) { |sock| serve(sock) }
@@ -175,6 +175,9 @@ module Specjour
175
175
  end
176
176
  IO.select([client.socket])
177
177
  end
178
+ rescue => e
179
+ $stderr.puts("Serve got an Error #{e.inspect}")
180
+ raise e
178
181
  end
179
182
 
180
183
  def done
@@ -204,7 +207,7 @@ module Specjour
204
207
 
205
208
  def register_tests(tests)
206
209
  @mutex.synchronize do
207
- if example_size == 0
210
+ if example_size == nil
208
211
  self.tests_to_run = run_order(tests)
209
212
  self.example_size = tests_to_run.size
210
213
  end
@@ -218,7 +221,7 @@ module Specjour
218
221
  end
219
222
 
220
223
  def unexpected_error(message)
221
- @output.puts message
224
+ Specjour.configuration.formatter.report_error(message)
222
225
  end
223
226
 
224
227
  def find_project_base_dir(directory)
@@ -242,10 +245,6 @@ module Specjour
242
245
  rspec_report.add(summary)
243
246
  end
244
247
 
245
- def cucumber_summary=(client, summary)
246
- cucumber_report.add(summary)
247
- end
248
-
249
248
  def add_to_profiler(test, time, host)
250
249
  @mutex.synchronize do
251
250
  self.profiler[test] = [time, host]
@@ -254,7 +253,7 @@ module Specjour
254
253
 
255
254
  def disconnecting
256
255
  @mutex.synchronize do
257
- debug "DISCONNECT #{@running} #{example_size} #{examples_complete}"
256
+ debug "DISCONNECT #{@running} #{example_size.inspect} #{examples_complete.inspect}"
258
257
  if @running && examples_complete == example_size
259
258
  @running = false
260
259
  debug "writing done"
@@ -277,10 +276,6 @@ module Specjour
277
276
  @rspec_report ||= RSpec::FinalReport.new
278
277
  end
279
278
 
280
- def cucumber_report
281
- @cucumber_report ||= Cucumber::FinalReport.new
282
- end
283
-
284
279
  # "test.rb" => [1.12, "host.local[2]"]
285
280
  def record_performance
286
281
  File.open('.specjour/performance', 'w') do |file|
@@ -58,7 +58,7 @@ module Specjour
58
58
  def print_status(test)
59
59
  status = "Running #{test}"
60
60
  log status
61
- $PROGRAM_NAME = "specjour #{status}"
61
+ $PROGRAM_NAME = "specjour[#{ENV["TEST_ENV_NUMBER"]}] #{status}"
62
62
  end
63
63
 
64
64
  def print_time_for(test, time)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specjour
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.rc2
4
+ version: 2.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Turriate
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-10 00:00:00.000000000 Z
11
+ date: 2017-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dnssd
@@ -96,7 +96,7 @@ dependencies:
96
96
  version: '0'
97
97
  description: |2
98
98
  Specjour splits your RSpec suite across multiple machines, and multiple
99
- cores per machine, to run super-parallel-fast! Also works with Cucumber.
99
+ cores per machine, to run super-parallel-fast!
100
100
  email: sandro.turriate@gmail.com
101
101
  executables:
102
102
  - specjour