tq 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gems +0 -0
- data/lib/tq.rb +4 -10
- data/lib/tq/logger.rb +0 -0
- data/lib/version.rb +1 -1
- data/test/helper.rb +0 -0
- data/test/suite.rb +1 -1
- data/test/test_auth.rb +0 -0
- data/test/test_logger.rb +0 -0
- data/test/test_queue_spec.rb +31 -0
- data/test/test_run.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8f311dc681edb3e301cf550ef596796c666d98c
|
4
|
+
data.tar.gz: e0cb1f8fe6b90e45a7652e1624bb24488d563818
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4015eee818de8172a13d5d5e2e120c59e84b8be0277571a7d99c8865a2b1ffb473b2c78f4a890e64157cc6777cb78128ecdc375ee9704fdfb8e2ee276787ebcd
|
7
|
+
data.tar.gz: ddc64156e773e339f31650d1607f3853cad70264bd1a926a0b077c9d43baafabd645966971770071fada8534a08b666896ce0dd55c2c46056a1ea57d3b530b3b
|
data/.gems
CHANGED
File without changes
|
data/lib/tq.rb
CHANGED
@@ -13,14 +13,6 @@ module TQ
|
|
13
13
|
|
14
14
|
API_SCOPES = ['https://www.googleapis.com/auth/cloud-tasks' ]
|
15
15
|
|
16
|
-
module Utils
|
17
|
-
|
18
|
-
def options_including(keys, options)
|
19
|
-
options.select { |k,_| keys.include?(k) }
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
16
|
class App
|
25
17
|
|
26
18
|
attr_reader :worker, :queue_in, :queue_out, :queue_err, :logger, :concurrency, :env
|
@@ -92,14 +84,16 @@ module TQ
|
|
92
84
|
end
|
93
85
|
|
94
86
|
class QueueSpec
|
95
|
-
extend TQ::Utils
|
96
87
|
|
97
88
|
def self.from_hash(data)
|
98
89
|
return new(
|
99
90
|
data['project'],
|
100
91
|
data['location'],
|
101
92
|
data['name'],
|
102
|
-
**
|
93
|
+
**( { lease_duration: data['lease_duration'],
|
94
|
+
max_tasks: data['max_tasks']
|
95
|
+
}.reject {|k,v| v.nil?}
|
96
|
+
)
|
103
97
|
)
|
104
98
|
end
|
105
99
|
|
data/lib/tq/logger.rb
CHANGED
File without changes
|
data/lib/version.rb
CHANGED
data/test/helper.rb
CHANGED
File without changes
|
data/test/suite.rb
CHANGED
data/test/test_auth.rb
CHANGED
File without changes
|
data/test/test_logger.rb
CHANGED
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative './helper'
|
2
|
+
require_relative '../lib/tq'
|
3
|
+
|
4
|
+
def setup_test_logger!
|
5
|
+
TestUtils.setup_logger( File.basename(__FILE__,'.rb') )
|
6
|
+
end
|
7
|
+
|
8
|
+
class QueueSpecTests < Minitest::Spec
|
9
|
+
|
10
|
+
describe "QueueSpec.from_hash" do
|
11
|
+
|
12
|
+
it "QueueSpec.from_hash with string keys should work" do
|
13
|
+
|
14
|
+
q = TQ::QueueSpec.from_hash( {
|
15
|
+
'project' => 'PROJECT',
|
16
|
+
'location' => 'us-central1',
|
17
|
+
'name' => 'QUEUE',
|
18
|
+
'lease_duration' => '200s',
|
19
|
+
'max_tasks' => 1
|
20
|
+
})
|
21
|
+
|
22
|
+
assert_equal '200s', q.lease_duration
|
23
|
+
assert_equal 1, q.max_tasks
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
|
data/test/test_run.rb
CHANGED
@@ -204,7 +204,7 @@ class AppRunTests < Minitest::Spec
|
|
204
204
|
ttl2 = task.lease_remaining
|
205
205
|
$stderr.puts "ExtendWorker - ttl before extend: #{ttl}"
|
206
206
|
$stderr.puts "ExtendWorker - ttl after extend: #{ttl2}"
|
207
|
-
assert_in_delta( 2.5, ttl2, 0.
|
207
|
+
assert_in_delta( 2.5, ttl2, 0.1,
|
208
208
|
"Expected to be approximately 2.5s"
|
209
209
|
)
|
210
210
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Gjertsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- test/suite.rb
|
67
67
|
- test/test_auth.rb
|
68
68
|
- test/test_logger.rb
|
69
|
+
- test/test_queue_spec.rb
|
69
70
|
- test/test_run.rb
|
70
71
|
homepage: https://github.com/ericgj/tq
|
71
72
|
licenses:
|
@@ -87,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
88
|
version: '0'
|
88
89
|
requirements: []
|
89
90
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
91
|
+
rubygems_version: 2.4.5.1
|
91
92
|
signing_key:
|
92
93
|
specification_version: 4
|
93
94
|
summary: Ruby client for Google Cloud Tasks (REST API v2beta2)
|