paraduct 0.0.1.beta16 → 0.0.1.beta17
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/paraduct/cli.rb +11 -3
- data/lib/paraduct/version.rb +1 -1
- data/paraduct.gemspec +1 -0
- data/spec/paraduct/cli_spec.rb +52 -39
- data/spec/spec_helper.rb +8 -0
- metadata +19 -3
data/lib/paraduct/cli.rb
CHANGED
@@ -14,6 +14,7 @@ module Paraduct
|
|
14
14
|
default_task :version
|
15
15
|
|
16
16
|
desc "test", "run matrix test"
|
17
|
+
option :dry_run, type: :boolean, default: false
|
17
18
|
def test
|
18
19
|
script = Paraduct.config.script
|
19
20
|
raise "require script" if script.blank?
|
@@ -24,9 +25,16 @@ module Paraduct
|
|
24
25
|
product_variables = Paraduct::VariableConverter.product(variables)
|
25
26
|
product_variables = Paraduct::VariableConverter.reject(product_variables, Paraduct.config.exclude)
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
if options[:dry_run]
|
29
|
+
product_variables.each do |params|
|
30
|
+
runner = Paraduct::Runner.new(params: params)
|
31
|
+
Paraduct.logger.info "[dry-run] params: #{runner.formatted_params}"
|
32
|
+
end
|
33
|
+
else
|
34
|
+
test_response = Paraduct::ParallelRunner.perform_all(script, product_variables)
|
35
|
+
Paraduct.logger.info test_response.detail_message
|
36
|
+
raise Paraduct::Errors::TestFailureError if test_response.failure?
|
37
|
+
end
|
30
38
|
end
|
31
39
|
|
32
40
|
desc "generate", "generate .paraduct.yml"
|
data/lib/paraduct/version.rb
CHANGED
data/paraduct.gemspec
CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.1.0"
|
36
36
|
spec.add_development_dependency "rspec-collection_matchers"
|
37
37
|
spec.add_development_dependency "rspec-its"
|
38
|
+
spec.add_development_dependency "rspec-retry"
|
38
39
|
spec.add_development_dependency "rspec-temp_dir"
|
39
40
|
spec.add_development_dependency "yard"
|
40
41
|
end
|
data/spec/paraduct/cli_spec.rb
CHANGED
@@ -19,53 +19,66 @@ describe Paraduct::CLI do
|
|
19
19
|
include_context :stub_configuration
|
20
20
|
include_context :within_temp_dir
|
21
21
|
|
22
|
-
context "
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
context "with no option" do
|
23
|
+
context "successful test" do
|
24
|
+
let(:config_data) do
|
25
|
+
{
|
26
|
+
script: "./script/build_success.sh",
|
27
|
+
work_dir: "tmp/paraduct_workspace",
|
28
|
+
variables: {
|
29
|
+
ruby: ["1.9.3", "2.0.0"],
|
30
|
+
database: ["mysql", "postgresql"],
|
31
|
+
},
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
let(:script){ "./script/build_success.sh" }
|
36
|
+
let(:product_variables) do
|
37
|
+
[
|
38
|
+
{ "ruby" => "1.9.3", "database" => "mysql" },
|
39
|
+
{ "ruby" => "1.9.3", "database" => "postgresql" },
|
40
|
+
{ "ruby" => "2.0.0", "database" => "mysql" },
|
41
|
+
{ "ruby" => "2.0.0", "database" => "postgresql" },
|
42
|
+
]
|
43
|
+
end
|
44
|
+
|
45
|
+
let(:test_response) do
|
46
|
+
test_response = Paraduct::TestResponse.new
|
47
|
+
test_response.jobs_push(successful: true)
|
48
|
+
test_response
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should call perform_all" do
|
52
|
+
expect(Paraduct::ParallelRunner).to receive(:perform_all).with(script, product_variables){ test_response }
|
53
|
+
subject
|
54
|
+
end
|
32
55
|
end
|
33
56
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
57
|
+
context "failure test" do
|
58
|
+
let(:config_data) do
|
59
|
+
{
|
60
|
+
script: %q(exit ${STATUS}),
|
61
|
+
work_dir: "tmp/paraduct_workspace",
|
62
|
+
variables: {
|
63
|
+
status: [0, 1],
|
64
|
+
},
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should raise TestFailureError", with_retry do
|
69
|
+
expect { subject }.to raise_error Paraduct::Errors::TestFailureError
|
70
|
+
end
|
42
71
|
end
|
72
|
+
end
|
43
73
|
|
44
|
-
|
45
|
-
|
46
|
-
test_response.jobs_push(successful: true)
|
47
|
-
test_response
|
48
|
-
end
|
74
|
+
context "with --dry-run" do
|
75
|
+
let(:args){ [command, "--dry-run"] }
|
49
76
|
|
50
|
-
it "should call perform_all" do
|
51
|
-
expect(Paraduct::ParallelRunner).
|
77
|
+
it "should not call perform_all" do
|
78
|
+
expect(Paraduct::ParallelRunner).not_to receive(:perform_all)
|
52
79
|
subject
|
53
80
|
end
|
54
81
|
end
|
55
|
-
|
56
|
-
context "failure test" do
|
57
|
-
let(:config_data) do
|
58
|
-
{
|
59
|
-
script: %q(exit ${STATUS}),
|
60
|
-
work_dir: "tmp/paraduct_workspace",
|
61
|
-
variables: {
|
62
|
-
status: [0, 1],
|
63
|
-
},
|
64
|
-
}
|
65
|
-
end
|
66
|
-
|
67
|
-
it { expect{ subject }.to raise_error Paraduct::Errors::TestFailureError }
|
68
|
-
end
|
69
82
|
end
|
70
83
|
|
71
84
|
describe "#generate" do
|
data/spec/spec_helper.rb
CHANGED
@@ -18,6 +18,7 @@ require 'paraduct/cli'
|
|
18
18
|
require 'rspec/collection_matchers'
|
19
19
|
require 'rspec/temp_dir'
|
20
20
|
require 'rspec/its'
|
21
|
+
require 'rspec/retry'
|
21
22
|
require 'pry'
|
22
23
|
|
23
24
|
is_verbose = ENV["VERBOSE"].present?
|
@@ -28,6 +29,11 @@ end
|
|
28
29
|
|
29
30
|
Dir["#{spec_dir}/support/**/*.rb"].sort.each { |f| require f }
|
30
31
|
|
32
|
+
# rspec-retry option
|
33
|
+
def with_retry
|
34
|
+
{retry: 3, retry_wait: 10}
|
35
|
+
end
|
36
|
+
|
31
37
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
32
38
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
33
39
|
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
@@ -119,6 +125,8 @@ RSpec.configure do |config|
|
|
119
125
|
|
120
126
|
config.order = :random
|
121
127
|
|
128
|
+
config.verbose_retry = true
|
129
|
+
|
122
130
|
config.before do
|
123
131
|
unless is_verbose
|
124
132
|
# quiet all logs
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paraduct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.beta17
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
12
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -267,6 +267,22 @@ dependencies:
|
|
267
267
|
- - ! '>='
|
268
268
|
- !ruby/object:Gem::Version
|
269
269
|
version: '0'
|
270
|
+
- !ruby/object:Gem::Dependency
|
271
|
+
name: rspec-retry
|
272
|
+
requirement: !ruby/object:Gem::Requirement
|
273
|
+
none: false
|
274
|
+
requirements:
|
275
|
+
- - ! '>='
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '0'
|
278
|
+
type: :development
|
279
|
+
prerelease: false
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
none: false
|
282
|
+
requirements:
|
283
|
+
- - ! '>='
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
270
286
|
- !ruby/object:Gem::Dependency
|
271
287
|
name: rspec-temp_dir
|
272
288
|
requirement: !ruby/object:Gem::Requirement
|
@@ -369,7 +385,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
369
385
|
version: '0'
|
370
386
|
segments:
|
371
387
|
- 0
|
372
|
-
hash:
|
388
|
+
hash: 2211847132159634412
|
373
389
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
374
390
|
none: false
|
375
391
|
requirements:
|