gorgon 0.10.5 → 0.11.0

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: 9fe52cba1d84d676b228d5a80486de29a191e036
4
- data.tar.gz: 0d2b782f2957592f67bd27b307421faeb35f7180
3
+ metadata.gz: 4c7715c6f11333845258e304eec73544db11135d
4
+ data.tar.gz: f4f2c0ca24b61ebd1e238673dbba746bb30a787f
5
5
  SHA512:
6
- metadata.gz: b987bad8d1d4ef05df182d97b3617e02991cc8b0e99a3337c3948eb72ed4995838e44d269d1eb9d74e6a5a662536d5674b43a8bdbd99e8decd49f406691e12f8
7
- data.tar.gz: 059f7e2f0be2d86d78c37903d2490634afe85e86956b4cfce6845056e09e876f6f772a750c4864689cc59d6b5a5cf1914249bd3ab826c996f24f24d9aba74288
6
+ metadata.gz: 16092b5b748104343f172c539d2dd0a8e625ce2c06bb628d717e4140729c2e77536e91c68914774241eb0ba242fd9c523434915d8908239c79e1ddf2061f16e8
7
+ data.tar.gz: 2a08a60a432b19c46ab7170cb2c4e0061fa9a8c1cc2b42b635a54d2d342457ba92929dbc936a460c97bf8aef20b24148e9108548ef9fa7c49222575ddae148b6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gorgon (0.10.5)
4
+ gorgon (0.11.0)
5
5
  amq-protocol (~> 1.9.2)
6
6
  amqp (~> 1.1.0)
7
7
  awesome_print
@@ -48,4 +48,4 @@ DEPENDENCIES
48
48
  test-unit
49
49
 
50
50
  BUNDLED WITH
51
- 1.12.5
51
+ 1.13.1
data/bin/gorgon CHANGED
@@ -16,7 +16,7 @@ WELCOME_MSG = "Welcome to Gorgon #{Gorgon::VERSION}"
16
16
 
17
17
  def start
18
18
  o = Originator.new
19
- o.originate
19
+ exit o.originate
20
20
  end
21
21
 
22
22
  def listen
@@ -77,7 +77,7 @@ end
77
77
  case ARGV[0] # special case for 'version', because we don't need the welcome message telling us the version when we're explicitly asking for it
78
78
  when "version", "--version"
79
79
  puts Gorgon::VERSION
80
- exit 0
80
+ exit
81
81
  end
82
82
 
83
83
  puts WELCOME_MSG
@@ -87,7 +87,7 @@ when nil
87
87
  start
88
88
  when "help", "--help"
89
89
  usage
90
- exit 0
90
+ exit
91
91
  when "start"
92
92
  start
93
93
  when "listen"
@@ -18,6 +18,12 @@ require 'socket'
18
18
  class Originator
19
19
  include Configuration
20
20
 
21
+ SPEC_SUCCESS_EXIT_STATUS = 0
22
+ SPEC_FAILURE_EXIT_STATUS = 1
23
+ SYNC_ERROR_EXIT_STATUS = 2
24
+ ERROR_EXIT_STATUS = 3
25
+
26
+
21
27
  def initialize
22
28
  @configuration = nil
23
29
  end
@@ -27,8 +33,9 @@ class Originator
27
33
  Signal.trap("INT") { ctrl_c }
28
34
  Signal.trap("TERM") { ctrl_c }
29
35
 
30
- publish
36
+ exit_status = publish
31
37
  @logger.log "Originator finished successfully"
38
+ exit_status
32
39
  rescue StandardError
33
40
  $stderr.puts "Unhandled exception in originator:"
34
41
  $stderr.puts $!.message
@@ -37,7 +44,7 @@ class Originator
37
44
  $stderr.puts "Now attempting to cancel the job."
38
45
  @logger.log_error "Unhandled Exception!" if @logger
39
46
  cancel_job
40
- exit 2
47
+ exit ERROR_EXIT_STATUS
41
48
  end
42
49
  end
43
50
 
@@ -51,11 +58,13 @@ class Originator
51
58
  end
52
59
 
53
60
  def publish
61
+ exit_status = SPEC_SUCCESS_EXIT_STATUS
62
+
54
63
  @logger = OriginatorLogger.new configuration[:originator_log_file]
55
64
 
56
65
  if files.empty?
57
66
  $stderr.puts "There are no files to test! Quitting."
58
- exit 2
67
+ exit ERROR_EXIT_STATUS
59
68
  end
60
69
 
61
70
  cluster_id = callback_handler.before_originate
@@ -68,7 +77,7 @@ class Originator
68
77
  publish_files_and_job
69
78
 
70
79
  @protocol.receive_payloads do |payload|
71
- handle_reply(payload)
80
+ exit_status |= handle_reply(payload)
72
81
  end
73
82
 
74
83
  @protocol.receive_new_listener_notifications do |payload|
@@ -77,6 +86,7 @@ class Originator
77
86
  end
78
87
 
79
88
  callback_handler.after_job_finishes
89
+ exit_status
80
90
  end
81
91
 
82
92
  def publish_files_and_job
@@ -105,7 +115,7 @@ class Originator
105
115
  $stderr.puts "Command '#{syncer.sys_command}' failed!"
106
116
  $stderr.puts "Stdout:\n#{syncer.output}"
107
117
  $stderr.puts "Stderr:\n#{syncer.errors}"
108
- exit 1
118
+ exit SYNC_ERROR_EXIT_STATUS
109
119
  end
110
120
  end
111
121
 
@@ -138,6 +148,7 @@ class Originator
138
148
  # ap payload
139
149
 
140
150
  cleanup_if_job_complete
151
+ exit_status(payload)
141
152
  end
142
153
 
143
154
  def handle_new_listener_notification(payload)
@@ -181,6 +192,11 @@ class Originator
181
192
 
182
193
  private
183
194
 
195
+ def exit_status(payload)
196
+ return SPEC_FAILURE_EXIT_STATUS if ["crash", "exception", "fail"].include?(payload[:type])
197
+ SPEC_SUCCESS_EXIT_STATUS
198
+ end
199
+
184
200
  def sync_configuration
185
201
  configuration[:job].
186
202
  fetch(:sync, {}).
@@ -1,3 +1,3 @@
1
1
  module Gorgon
2
- VERSION = "0.10.5"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -33,6 +33,17 @@ describe Originator do
33
33
  @originator.publish
34
34
  end
35
35
 
36
+ it "propagates the success result of handle_reply" do
37
+ @originator.publish.should eq Originator::SPEC_SUCCESS_EXIT_STATUS
38
+ end
39
+
40
+ it "propagates the error result of handle_reply" do
41
+ OriginatorProtocol.should_receive(:new).and_return(protocol)
42
+ protocol.should_receive(:receive_payloads).and_yield(Yajl::Encoder.encode({:type => 'fail'}))
43
+
44
+ @originator.publish.should eq Originator::SPEC_FAILURE_EXIT_STATUS
45
+ end
46
+
36
47
  it "creates a ProgressBarView and show" do
37
48
  JobState.stub(:new).and_return job_state
38
49
  ProgressBarView.should_receive(:new).with(job_state).and_return progress_bar_view
@@ -83,7 +94,7 @@ describe Originator do
83
94
 
84
95
  it "exits with a non-zero status code when the originator crashes" do
85
96
  originator_logger.stub(:log_error)
86
- $stderr = StringIO.new # slurp up the error output so we don't pollute the rsync run
97
+ $stderr = StringIO.new # slurp up the error output so we don't pollute the rspec run
87
98
  CallbackHandler.any_instance.should_receive(:before_originate).and_throw("I'm an unhandled exception")
88
99
 
89
100
  expect { @originator.originate }.to raise_error(SystemExit) do |error|
@@ -138,6 +149,29 @@ describe Originator do
138
149
  @originator.publish
139
150
  end
140
151
 
152
+ it "returns SPEC_SUCCESS_EXIT_STATUS when payload[:action] is start" do
153
+ job_state.stub(:file_started)
154
+ @originator.handle_reply(start_payload).should eq Originator::SPEC_SUCCESS_EXIT_STATUS
155
+ end
156
+
157
+ it "returns SPEC_SUCCESS_EXIT_STATUS when payload[:action] is finish" do
158
+ job_state.stub(:file_finished)
159
+ @originator.handle_reply(finish_payload).should eq Originator::SPEC_SUCCESS_EXIT_STATUS
160
+ end
161
+
162
+ it "returns SPEC_FAILURE_EXIT_STATUS when payload[:action] is crash" do
163
+ job_state.stub(:gorgon_crash_message)
164
+ @originator.handle_reply(Yajl::Encoder.encode(gorgon_crash_message)).should eq Originator::SPEC_FAILURE_EXIT_STATUS
165
+ end
166
+
167
+ it "returns SPEC_FAILURE_EXIT_STATUS when payload[:action] is exception" do
168
+ @originator.handle_reply(Yajl::Encoder.encode({:type => 'exception'})).should eq Originator::SPEC_FAILURE_EXIT_STATUS
169
+ end
170
+
171
+ it "returns SPEC_FAILURE_EXIT_STATUS when payload[:action] is fail" do
172
+ @originator.handle_reply(Yajl::Encoder.encode({:type => 'fail'})).should eq Originator::SPEC_FAILURE_EXIT_STATUS
173
+ end
174
+
141
175
  it "calls cleanup_if_job_complete" do
142
176
  @originator.should_receive(:cleanup_if_job_complete)
143
177
  @originator.handle_reply finish_payload
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorgon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.5
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Fitzsimmons
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-08-26 00:00:00.000000000 Z
15
+ date: 2016-10-28 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake
@@ -400,8 +400,87 @@ required_rubygems_version: !ruby/object:Gem::Requirement
400
400
  version: '0'
401
401
  requirements: []
402
402
  rubyforge_project: gorgon
403
- rubygems_version: 2.4.8
403
+ rubygems_version: 2.6.7
404
404
  signing_key:
405
405
  specification_version: 4
406
406
  summary: Distributed testing for ruby with centralized management
407
- test_files: []
407
+ test_files:
408
+ - spec/acceptance_spec_helper.rb
409
+ - spec/callback_handler_spec.rb
410
+ - spec/crash_reporter_spec.rb
411
+ - spec/failures_printer_spec.rb
412
+ - spec/gem_command_handler_spec.rb
413
+ - spec/gem_service_spec.rb
414
+ - spec/gorgon_rspec_formatter_spec.rb
415
+ - spec/host_state_spec.rb
416
+ - spec/job_definition_spec.rb
417
+ - spec/job_state_spec.rb
418
+ - spec/listener_spec.rb
419
+ - spec/mini_test_runner_spec.rb
420
+ - spec/originator_logger_spec.rb
421
+ - spec/originator_protocol_spec.rb
422
+ - spec/originator_spec.rb
423
+ - spec/ping_service_spec.rb
424
+ - spec/pipe_forker_spec.rb
425
+ - spec/progress_bar_view_spec.rb
426
+ - spec/rspec_runner_spec.rb
427
+ - spec/rsync_daemon_spec.rb
428
+ - spec/runtime_file_reader_spec.rb
429
+ - spec/runtime_recorder_spec.rb
430
+ - spec/shutdown_manager_spec.rb
431
+ - spec/source_tree_syncer_spec.rb
432
+ - spec/support/mock_app/.gitignore
433
+ - spec/support/mock_app/Gemfile
434
+ - spec/support/mock_app/Gemfile.lock
435
+ - spec/support/mock_app/README.rdoc
436
+ - spec/support/mock_app/Rakefile
437
+ - spec/support/mock_app/app/assets/images/rails.png
438
+ - spec/support/mock_app/app/assets/javascripts/application.js
439
+ - spec/support/mock_app/app/assets/stylesheets/application.css
440
+ - spec/support/mock_app/app/controllers/application_controller.rb
441
+ - spec/support/mock_app/app/helpers/application_helper.rb
442
+ - spec/support/mock_app/app/mailers/.gitkeep
443
+ - spec/support/mock_app/app/models/.gitkeep
444
+ - spec/support/mock_app/app/views/layouts/application.html.erb
445
+ - spec/support/mock_app/config.ru
446
+ - spec/support/mock_app/config/application.rb
447
+ - spec/support/mock_app/config/boot.rb
448
+ - spec/support/mock_app/config/database.yml
449
+ - spec/support/mock_app/config/environment.rb
450
+ - spec/support/mock_app/config/environments/development.rb
451
+ - spec/support/mock_app/config/environments/production.rb
452
+ - spec/support/mock_app/config/environments/test.rb
453
+ - spec/support/mock_app/config/initializers/backtrace_silencers.rb
454
+ - spec/support/mock_app/config/initializers/inflections.rb
455
+ - spec/support/mock_app/config/initializers/mime_types.rb
456
+ - spec/support/mock_app/config/initializers/secret_token.rb
457
+ - spec/support/mock_app/config/initializers/session_store.rb
458
+ - spec/support/mock_app/config/initializers/wrap_parameters.rb
459
+ - spec/support/mock_app/config/locales/en.yml
460
+ - spec/support/mock_app/config/routes.rb
461
+ - spec/support/mock_app/db/seeds.rb
462
+ - spec/support/mock_app/doc/README_FOR_APP
463
+ - spec/support/mock_app/lib/assets/.gitkeep
464
+ - spec/support/mock_app/lib/tasks/.gitkeep
465
+ - spec/support/mock_app/log/.gitkeep
466
+ - spec/support/mock_app/public/404.html
467
+ - spec/support/mock_app/public/422.html
468
+ - spec/support/mock_app/public/500.html
469
+ - spec/support/mock_app/public/favicon.ico
470
+ - spec/support/mock_app/public/index.html
471
+ - spec/support/mock_app/public/robots.txt
472
+ - spec/support/mock_app/script/rails
473
+ - spec/support/mock_app/test/fixtures/.gitkeep
474
+ - spec/support/mock_app/test/functional/.gitkeep
475
+ - spec/support/mock_app/test/integration/.gitkeep
476
+ - spec/support/mock_app/test/performance/browsing_test.rb
477
+ - spec/support/mock_app/test/test_helper.rb
478
+ - spec/support/mock_app/test/unit/.gitkeep
479
+ - spec/support/mock_app/test/unit/passing_test.rb
480
+ - spec/support/mock_app/vendor/assets/javascripts/.gitkeep
481
+ - spec/support/mock_app/vendor/assets/stylesheets/.gitkeep
482
+ - spec/support/mock_app/vendor/plugins/.gitkeep
483
+ - spec/support/originator_handler.rb
484
+ - spec/unknown_runner_spec.rb
485
+ - spec/worker_manager_spec.rb
486
+ - spec/worker_spec.rb