sqewer 3.0.0 → 3.0.1

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: 376905158864071505965ba29e27d67552fed4dc
4
- data.tar.gz: 1cffb36287c14210508ca0c36357109fd9862c3d
3
+ metadata.gz: edded56859437d9b7bce9424d2c00b4a8d999756
4
+ data.tar.gz: aaa87e0f5ab8a4fe1b0c73682e4282bd7b52534b
5
5
  SHA512:
6
- metadata.gz: 7669344c1b8c11aacac7ca2d7ba7e6792301fb4711cb4c9de4c4b3cbaf6eb2157ddfe96fec137433cb12279214ab948f349af340629bf2ae1909c46050200fd9
7
- data.tar.gz: e2ef1bf783999d3b8fab81c86be905be543ac34a7887adc21eaf39cb7096b44e8cc150ea0698bae5571d2c40dae5de2021c95cb2da7a972ff94f96b171eab825
6
+ metadata.gz: 8c0394391564b80cd5148dfb4446561ae29902e4e05fc62360b0d0fa454effb25d6bc62978f3b2a81fcd3021c7cc59afbad8031c6bb5fcef1cfd18965e87f233
7
+ data.tar.gz: 7daa39ca0ee05abf18c65f9bfbe59d334160522243a3a1fb0589ba413070893d89f0896e57597506678459951337bb29a4fa686fb6442d99ae47aef8f7f65d35
data/Gemfile CHANGED
@@ -10,6 +10,7 @@ group :development do
10
10
  gem 'dotenv'
11
11
  gem 'rake'
12
12
  gem "rspec", "~> 3.2.0"
13
+ gem 'rspec-wait'
13
14
  gem 'simplecov', :require => false
14
15
  # gem "autospec" -> I would love to have this, but it wants capybara-webkit too :-(
15
16
  gem "rdoc", "~> 3.12"
@@ -51,7 +51,9 @@ class Sqewer::Isolator
51
51
  middleware_stack.around_execution(job, context) do
52
52
  job.method(:run).arity.zero? ? job.run : job.run(context)
53
53
  end
54
- logger.info { "[worker] Finished #{job.inspect} in %0.2fs" % (Time.now - t) }
54
+ # FIXME: do not mix templating and format strings
55
+ delta = Time.now - t
56
+ logger.info { "[worker] Finished %s in %0.2fs" % [job.inspect, delta] }
55
57
  rescue => e
56
58
  logger.error { "[worker] Failed #{job.inspect} with a #{e}" } if job
57
59
  raise e
@@ -1,3 +1,3 @@
1
1
  module Sqewer
2
- VERSION = '3.0.0'
2
+ VERSION = '3.0.1'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -2,36 +2,17 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
 
4
4
  require 'rspec'
5
- require 'simplecov'
6
-
5
+ require 'rspec/wait'
7
6
  require 'dotenv'
8
- Dotenv.load
9
-
10
7
  require 'aws-sdk'
8
+ require 'simplecov'
9
+ Dotenv.load
11
10
 
12
11
  SimpleCov.start
13
12
  require 'sqewer'
14
13
 
15
- module Polling
16
- # Call the given block every N seconds, and return once the
17
- # block returns a truthy value. If it still did not return
18
- # the value after fail_after, fail the spec.
19
- def poll(every: 0.5, fail_after:, &check_block)
20
- started_polling = Time.now
21
- loop do
22
- return if check_block.call
23
- sleep(every)
24
- if (Time.now - started_polling) > fail_after
25
- fail "Waited for #{fail_after} seconds for the operation to complete but it didnt"
26
- end
27
- end
28
- end
29
- end
30
-
31
14
  RSpec.configure do |config|
32
15
  config.order = 'random'
33
- config.include Polling
34
-
35
16
  config.around :each do | example |
36
17
  if example.metadata[:sqs]
37
18
  queue_name = 'conveyor-belt-test-queue-%s' % SecureRandom.hex(6)
@@ -1,6 +1,10 @@
1
1
  require_relative '../spec_helper'
2
2
 
3
- describe Sqewer::CLI, :sqs => true do
3
+ describe Sqewer::CLI, :sqs => true, :wait => {timeout: 120} do
4
+ after :each do
5
+ Dir.glob('*-result').each{|path| File.unlink(path) }
6
+ end
7
+
4
8
  describe 'runs the commandline app, executes jobs and then quits cleanly' do
5
9
  it 'on a USR1 signal' do
6
10
  submitter = Sqewer::Connection.default
@@ -17,13 +21,12 @@ describe Sqewer::CLI, :sqs => true do
17
21
  end
18
22
  end
19
23
 
20
- sleep 8 # Give it some time to process all the jobs
24
+ sleep 10 # Give it some time to process all the jobs
21
25
  Process.kill("USR1", pid)
22
- sleep 2
26
+ wait_for { Process.wait(pid) }
23
27
 
24
28
  generated_files = Dir.glob('*-result')
25
29
  expect(generated_files).not_to be_empty
26
- generated_files.each{|path| File.unlink(path) }
27
30
 
28
31
  stderr.rewind
29
32
  log_output = stderr.read
@@ -47,7 +50,8 @@ describe Sqewer::CLI, :sqs => true do
47
50
 
48
51
  sleep 4
49
52
  Process.kill("TERM", pid)
50
-
53
+ wait_for { Process.wait(pid) }
54
+
51
55
  generated_files = Dir.glob('*-result')
52
56
  expect(generated_files).not_to be_empty
53
57
  generated_files.each{|path| File.unlink(path) }
@@ -97,8 +97,8 @@ describe Sqewer::Worker, :sqs => true do
97
97
  worker.start
98
98
 
99
99
  begin
100
- poll(fail_after: 3) { File.exist?('initial-job-run') }
101
- poll(fail_after: 3) { File.exist?('secondary-job-run') }
100
+ wait_for { File.exist?('initial-job-run') }.to eq(true)
101
+ wait_for { File.exist?('secondary-job-run') }.to eq(true)
102
102
 
103
103
  File.unlink('initial-job-run')
104
104
  File.unlink('secondary-job-run')
@@ -130,8 +130,8 @@ describe Sqewer::Worker, :sqs => true do
130
130
  worker.start
131
131
 
132
132
  begin
133
- poll(fail_after: 3) { File.exist?('initial-job-run') }
134
- poll(fail_after: 3) { File.exist?('secondary-job-run') }
133
+ wait_for { File.exist?('initial-job-run') }.to eq(true)
134
+ wait_for { File.exist?('secondary-job-run') }.to eq(true)
135
135
 
136
136
  File.unlink('initial-job-run')
137
137
  File.unlink('secondary-job-run')
data/sqewer.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: sqewer 3.0.0 ruby lib
5
+ # stub: sqewer 3.0.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "sqewer"
9
- s.version = "3.0.0"
9
+ s.version = "3.0.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Julik Tarkhanov"]
14
- s.date = "2016-01-25"
14
+ s.date = "2016-02-03"
15
15
  s.description = "Process jobs from SQS"
16
16
  s.email = "me@julik.nl"
17
17
  s.extra_rdoc_files = [
@@ -73,6 +73,7 @@ Gem::Specification.new do |s|
73
73
  s.add_development_dependency(%q<dotenv>, [">= 0"])
74
74
  s.add_development_dependency(%q<rake>, [">= 0"])
75
75
  s.add_development_dependency(%q<rspec>, ["~> 3.2.0"])
76
+ s.add_development_dependency(%q<rspec-wait>, [">= 0"])
76
77
  s.add_development_dependency(%q<simplecov>, [">= 0"])
77
78
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
78
79
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
@@ -86,6 +87,7 @@ Gem::Specification.new do |s|
86
87
  s.add_dependency(%q<dotenv>, [">= 0"])
87
88
  s.add_dependency(%q<rake>, [">= 0"])
88
89
  s.add_dependency(%q<rspec>, ["~> 3.2.0"])
90
+ s.add_dependency(%q<rspec-wait>, [">= 0"])
89
91
  s.add_dependency(%q<simplecov>, [">= 0"])
90
92
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
91
93
  s.add_dependency(%q<bundler>, ["~> 1.0"])
@@ -100,6 +102,7 @@ Gem::Specification.new do |s|
100
102
  s.add_dependency(%q<dotenv>, [">= 0"])
101
103
  s.add_dependency(%q<rake>, [">= 0"])
102
104
  s.add_dependency(%q<rspec>, ["~> 3.2.0"])
105
+ s.add_dependency(%q<rspec-wait>, [">= 0"])
103
106
  s.add_dependency(%q<simplecov>, [">= 0"])
104
107
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
105
108
  s.add_dependency(%q<bundler>, ["~> 1.0"])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 3.2.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec-wait
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: simplecov
127
141
  requirement: !ruby/object:Gem::Requirement