propeller 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/misc.xml +20 -0
- data/.idea/modules.xml +9 -0
- data/.idea/runConfigurations/Run_spec__basic_request_spec___propeller.xml +38 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +7 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +44 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +22 -0
- data/README 2.md +29 -0
- data/README.md +6 -0
- data/Rakefile +1 -0
- data/bin/demo.yml +7 -0
- data/bin/propeller +5 -0
- data/bin/propeller.rb +5 -0
- data/lib/propeller.rb +143 -0
- data/lib/propeller/version.rb +3 -0
- data/propeller-0.0.3.gem +0 -0
- data/propeller.gemspec +28 -0
- data/spec/basic_request_spec.rb +83 -0
- data/spec/invalid_url.yml +4 -0
- data/spec/test.yml +10 -0
- data/spec/valid_url.yml +7 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 96b94e7172cdb78728ef543b5ab2047adee355c2
|
4
|
+
data.tar.gz: 102221d03c4d9d09d88eadfa67b78835d5fd4ead
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 91ed63dfa830e0c50be434f4fb095818d25f5c6f2de7fa36c826526d80dd1e941aad007683783bceee768304e3d7e8faf3ad2a0bbaa49a366b55c39ac51d574b
|
7
|
+
data.tar.gz: cb4e3b6e5b876414432a97c67725410816f8311dd579899e60abb9ec637241b6c2de4b718c10fbbad328a5e9b0af36e8ae181f27ff4d479e150a89f303e36489
|
data/.gitignore
ADDED
data/.idea/.name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
propeller
|
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build propeller-0.0.3.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install propeller-0.0.3.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v0.0.3 and build and push propeller-0.0.3.gem to Rubygems" fullCmd="release" taksId="release" /></RakeGroup></Settings>
|
data/.idea/encodings.xml
ADDED
data/.idea/misc.xml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.0.0-p353" project-jdk-type="RUBY_SDK" />
|
4
|
+
<component name="masterDetails">
|
5
|
+
<states>
|
6
|
+
<state key="ScopeChooserConfigurable.UI">
|
7
|
+
<settings>
|
8
|
+
<splitter-proportions>
|
9
|
+
<option name="proportions">
|
10
|
+
<list>
|
11
|
+
<option value="0.2" />
|
12
|
+
</list>
|
13
|
+
</option>
|
14
|
+
</splitter-proportions>
|
15
|
+
</settings>
|
16
|
+
</state>
|
17
|
+
</states>
|
18
|
+
</component>
|
19
|
+
</project>
|
20
|
+
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/propeller.iml" filepath="$PROJECT_DIR$/.idea/propeller.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
9
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
2
|
+
<configuration default="false" name="Run spec 'basic_request_spec': propeller" type="RSpecRunConfigurationType" factoryName="RSpec">
|
3
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
4
|
+
<module name="propeller" />
|
5
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
6
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
7
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
8
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
9
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
10
|
+
<envs>
|
11
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
12
|
+
</envs>
|
13
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
14
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
15
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
16
|
+
<COVERAGE_PATTERN ENABLED="true">
|
17
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
18
|
+
</COVERAGE_PATTERN>
|
19
|
+
</EXTENSION>
|
20
|
+
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
|
21
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
22
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/basic_request_spec.rb" />
|
23
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
24
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
25
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
26
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
27
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
28
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
29
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
30
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
31
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
32
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
33
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
34
|
+
<RunnerSettings RunnerId="RubyRunner" />
|
35
|
+
<ConfigurationWrapper RunnerId="RubyRunner" />
|
36
|
+
<method />
|
37
|
+
</configuration>
|
38
|
+
</component>
|
data/.idea/vcs.xml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
propeller (0.0.4)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.3.5)
|
10
|
+
crack (0.4.1)
|
11
|
+
safe_yaml (~> 0.9.0)
|
12
|
+
diff-lcs (1.2.5)
|
13
|
+
httparty (0.12.0)
|
14
|
+
json (~> 1.8)
|
15
|
+
multi_xml (>= 0.5.2)
|
16
|
+
json (1.8.1-java)
|
17
|
+
multi_xml (0.5.5)
|
18
|
+
parallel (1.0.0)
|
19
|
+
rake (10.1.1)
|
20
|
+
rspec (2.14.1)
|
21
|
+
rspec-core (~> 2.14.0)
|
22
|
+
rspec-expectations (~> 2.14.0)
|
23
|
+
rspec-mocks (~> 2.14.0)
|
24
|
+
rspec-core (2.14.7)
|
25
|
+
rspec-expectations (2.14.4)
|
26
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
27
|
+
rspec-mocks (2.14.4)
|
28
|
+
safe_yaml (0.9.7)
|
29
|
+
webmock (1.16.1)
|
30
|
+
addressable (>= 2.2.7)
|
31
|
+
crack (>= 0.3.2)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
java
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
bundler (~> 1.3)
|
38
|
+
httparty
|
39
|
+
parallel
|
40
|
+
propeller!
|
41
|
+
rake
|
42
|
+
rspec
|
43
|
+
rspec-core
|
44
|
+
webmock
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Mauricio Giraldo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Mauricio Giraldo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README 2.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Propeller
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'propeller'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install propeller
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/demo.yml
ADDED
data/bin/propeller
ADDED
data/bin/propeller.rb
ADDED
data/lib/propeller.rb
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
require "propeller/version"
|
2
|
+
require 'parallel'
|
3
|
+
require 'yaml'
|
4
|
+
require 'httparty'
|
5
|
+
require 'benchmark'
|
6
|
+
|
7
|
+
module Propeller
|
8
|
+
|
9
|
+
def self.argumentsHelp
|
10
|
+
|
11
|
+
puts "propeller -f:YAML_File [-output:'screen,junit'] [-help]"
|
12
|
+
puts "-help : This help screen."
|
13
|
+
puts "-f : Configuration file."
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.tester
|
18
|
+
res = ""
|
19
|
+
results = Parallel.map(['a','b','c'], :in_threads=>3) do |one_letter|
|
20
|
+
res = res + one_letter
|
21
|
+
end
|
22
|
+
res
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.run args
|
26
|
+
|
27
|
+
path_to_yaml = nil
|
28
|
+
|
29
|
+
output = "screen"
|
30
|
+
|
31
|
+
output_file = "results.xml"
|
32
|
+
|
33
|
+
if args
|
34
|
+
args.each do|argument|
|
35
|
+
|
36
|
+
puts "Propeller v." + Propeller::VERSION
|
37
|
+
|
38
|
+
arg = argument.split(':')
|
39
|
+
|
40
|
+
|
41
|
+
case arg[0]
|
42
|
+
when "-f"
|
43
|
+
path_to_yaml = arg[1]
|
44
|
+
when "-help"
|
45
|
+
argumentsHelp
|
46
|
+
when "-output"
|
47
|
+
output = arg[1]
|
48
|
+
when "-output_file"
|
49
|
+
output_file = arg[1]
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
if(path_to_yaml && File.exists?(path_to_yaml))
|
55
|
+
|
56
|
+
suites = {errors: 0, failures: 0, skipped: 0, tests: 0, time: 0, timestamp: 0, suite:[]}
|
57
|
+
suite = {errors: 0, failures: 0, skipped: 0, tests: 0, name: 'Propeller Test', testcases: []}
|
58
|
+
|
59
|
+
params = load_params(path_to_yaml)
|
60
|
+
runs = 0
|
61
|
+
url = params['Resources']['url']
|
62
|
+
success = 0
|
63
|
+
fails = 0
|
64
|
+
ok = 0
|
65
|
+
not_found = 0
|
66
|
+
error = 0
|
67
|
+
url_response = nil
|
68
|
+
|
69
|
+
time = Benchmark.realtime {
|
70
|
+
Parallel.in_processes(params['Resources']['threads']) do
|
71
|
+
begin
|
72
|
+
Parallel.map(params['Resources']['urls']) do |address|
|
73
|
+
runs = runs + 1
|
74
|
+
elapsed_time = Benchmark.realtime {
|
75
|
+
if(params['Resources']['params'])
|
76
|
+
url_response = HTTParty.post(address, :body => params['Resources']['params'])
|
77
|
+
else
|
78
|
+
url_response = HTTParty.get(address)
|
79
|
+
end
|
80
|
+
}
|
81
|
+
case url_response.code
|
82
|
+
when 200
|
83
|
+
ok = ok + 1
|
84
|
+
when 404
|
85
|
+
not_found = not_found + 1
|
86
|
+
when 500...600
|
87
|
+
error = error + 1
|
88
|
+
end
|
89
|
+
success = success + 1
|
90
|
+
testcase = {name: address,time: elapsed_time}
|
91
|
+
suite[:testcases] << testcase
|
92
|
+
|
93
|
+
end
|
94
|
+
rescue Exception => e
|
95
|
+
puts e.inspect
|
96
|
+
fails = fails + 1
|
97
|
+
end
|
98
|
+
end
|
99
|
+
}
|
100
|
+
suite[:errors] = error
|
101
|
+
suite[:failures] = fails
|
102
|
+
suite[:tests] = runs
|
103
|
+
suite[:time] = time
|
104
|
+
suite[:timestamp] = DateTime.now
|
105
|
+
suites[:suite] << suite
|
106
|
+
junit_output suites
|
107
|
+
result = {runs: runs, result: 'Success', success: success, fails: fails, elapsed: time, ok: ok, not_found: not_found, error: error}
|
108
|
+
else
|
109
|
+
result = 'Propeller requires a configuration file'
|
110
|
+
end
|
111
|
+
|
112
|
+
if output == 'junit'
|
113
|
+
File.open(output_file, 'w') { |file| file.write(junit_output suites) }
|
114
|
+
result = "Results exported to " + output_file
|
115
|
+
end
|
116
|
+
else
|
117
|
+
result = 'No arguments provided'
|
118
|
+
end
|
119
|
+
puts result
|
120
|
+
result
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.verify_params path_to_yaml
|
124
|
+
load_params path_to_yaml
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.load_params(path_to_yaml)
|
128
|
+
params = YAML.load_file(path_to_yaml)
|
129
|
+
params
|
130
|
+
end
|
131
|
+
|
132
|
+
def self.junit_output suites
|
133
|
+
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
134
|
+
xml = xml + "<testsuites errors=\"#{suites[:errors].to_s}\" failures=\"#{suites[:failures].to_s}\" skipped=\"0\" tests=\"#{suites[:tests].to_s}\" time=\"#{suites[:time].to_s}\" timestamp=\"#{suites[:timestamp].to_s}\">"
|
135
|
+
xml = xml + "<testsuite name=\"Propeller Tests\" tests=\"#{suites[:suite][0][:tests].to_s}\" errors=\"#{suites[:suite][0][:errors].to_s}\" failures=\"#{suites[:suite][0][:failures].to_s}\" skipped=\"0\"><properties/>"
|
136
|
+
suites[:suite][0][:testcases].each { |test| xml = xml + "<testcase name=\"#{test[:name]}\" time=\"#{test[:elapsed_time]}\"></testcase>"}
|
137
|
+
xml = xml + "</testsuite></testsuites>"
|
138
|
+
xml
|
139
|
+
end
|
140
|
+
|
141
|
+
private_class_method :load_params
|
142
|
+
|
143
|
+
end
|
data/propeller-0.0.3.gem
ADDED
Binary file
|
data/propeller.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'propeller/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "propeller"
|
8
|
+
spec.version = Propeller::VERSION
|
9
|
+
spec.authors = ["Mauricio Giraldo"]
|
10
|
+
spec.email = ["mgiraldo@gmail.com"]
|
11
|
+
spec.description = "Basic Gem to query URLs in parallel"
|
12
|
+
spec.summary = "Using a basic Yaml file, Propeller can dispatch parallel request to a number of urls and collects the results in a hash or in a Junit formatted xml"
|
13
|
+
spec.homepage = "https://github.com/giraldomauricio/propeller"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
#spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.executables = ["propeller"]
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
spec.add_development_dependency "parallel"
|
26
|
+
spec.add_development_dependency "httparty"
|
27
|
+
spec.add_development_dependency "webmock"
|
28
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'propeller'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
|
5
|
+
describe 'My behaviour' do
|
6
|
+
|
7
|
+
it 'Tester should run' do
|
8
|
+
Propeller.tester.include? 'a'
|
9
|
+
Propeller.tester.include? 'b'
|
10
|
+
Propeller.tester.include? 'c'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'Validate configuration' do
|
15
|
+
|
16
|
+
it 'should read the configuration file' do
|
17
|
+
puts "++++" + Dir.pwd
|
18
|
+
result = Propeller.verify_params Dir.pwd + "/spec/test.yml"
|
19
|
+
expect(result['Resources']['threads']).to eq(3)
|
20
|
+
expect(result['Resources']['urls'].length).to eq(4)
|
21
|
+
expect(result['Resources']['params'].length).to eq(2)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should fail with no configuration file' do
|
25
|
+
result = Propeller.run(nil)
|
26
|
+
expect(result.to_s).to include('No arguments provided')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should fail with a bad configuration file' do
|
30
|
+
result = Propeller.run(["-f:foo"])
|
31
|
+
expect(result.to_s).to include('Propeller requires a configuration file')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'Validate basic run' do
|
36
|
+
|
37
|
+
it 'should run based on the configuration file' do
|
38
|
+
|
39
|
+
stub_request(:post, "http://www.apple.com/").
|
40
|
+
with(:body => "username=foo&password=bar").
|
41
|
+
to_return(:status => 200, :body => "", :headers => {})
|
42
|
+
|
43
|
+
stub_request(:post, "http://www.amazon.com/").
|
44
|
+
with(:body => "username=foo&password=bar").
|
45
|
+
to_return(:status => 200, :body => "", :headers => {})
|
46
|
+
|
47
|
+
stub_request(:post, "http://www.appleadkfnodnfkd.com/").
|
48
|
+
with(:body => "username=foo&password=bar").
|
49
|
+
to_return(:status => 200, :body => "", :headers => {})
|
50
|
+
|
51
|
+
stub_request(:post, "http://www.google.com/").
|
52
|
+
with(:body => "username=foo&password=bar").
|
53
|
+
to_return(:status => 200, :body => "", :headers => {})
|
54
|
+
|
55
|
+
result = Propeller.run ["-f:" +Dir.pwd + "/spec/test.yml"]
|
56
|
+
expect(result[:runs]).to be >= 10
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should run based on the invalid_url configuration file' do
|
60
|
+
|
61
|
+
stub_request(:get, "http://appleadkfnodnfkd.com/").
|
62
|
+
to_return(:status => 500, :body => "", :headers => {})
|
63
|
+
|
64
|
+
result = Propeller.run ["-f:" +Dir.pwd + "/spec/invalid_url.yml"]
|
65
|
+
expect(result[:runs]).to eq(1)
|
66
|
+
expect(result[:error]).to eq(1)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should run based on the valid_url configuration file' do
|
70
|
+
|
71
|
+
stub_request(:post, "http://www.apple.com/").
|
72
|
+
with(:body => "username=foo&password=bar").
|
73
|
+
to_return(:status => 200, :body => "", :headers => {})
|
74
|
+
|
75
|
+
result = Propeller.run ["-f:" + Dir.pwd + "/bin/demo.yml"]
|
76
|
+
expect(result[:runs]).to eq(1)
|
77
|
+
expect(result[:success]).to eq(1)
|
78
|
+
expect(result[:fails]).to eq(0)
|
79
|
+
expect(result[:success]).to eq(1)
|
80
|
+
expect(result[:ok]).to eq(1)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
data/spec/test.yml
ADDED
data/spec/valid_url.yml
ADDED
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: propeller
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mauricio Giraldo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ~>
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '1.3'
|
25
|
+
prerelease: false
|
26
|
+
type: :development
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
prerelease: false
|
40
|
+
type: :development
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
prerelease: false
|
54
|
+
type: :development
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: parallel
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
prerelease: false
|
68
|
+
type: :development
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: httparty
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
prerelease: false
|
82
|
+
type: :development
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
prerelease: false
|
96
|
+
type: :development
|
97
|
+
description: Basic Gem to query URLs in parallel
|
98
|
+
email:
|
99
|
+
- mgiraldo@gmail.com
|
100
|
+
executables:
|
101
|
+
- propeller
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- .gitignore
|
106
|
+
- .idea/.name
|
107
|
+
- .idea/.rakeTasks
|
108
|
+
- .idea/encodings.xml
|
109
|
+
- .idea/misc.xml
|
110
|
+
- .idea/modules.xml
|
111
|
+
- .idea/runConfigurations/Run_spec__basic_request_spec___propeller.xml
|
112
|
+
- .idea/scopes/scope_settings.xml
|
113
|
+
- .idea/vcs.xml
|
114
|
+
- .travis.yml
|
115
|
+
- Gemfile
|
116
|
+
- Gemfile.lock
|
117
|
+
- LICENSE
|
118
|
+
- LICENSE.txt
|
119
|
+
- README 2.md
|
120
|
+
- README.md
|
121
|
+
- Rakefile
|
122
|
+
- bin/demo.yml
|
123
|
+
- bin/propeller
|
124
|
+
- bin/propeller.rb
|
125
|
+
- lib/propeller.rb
|
126
|
+
- lib/propeller/version.rb
|
127
|
+
- propeller-0.0.3.gem
|
128
|
+
- propeller.gemspec
|
129
|
+
- spec/basic_request_spec.rb
|
130
|
+
- spec/invalid_url.yml
|
131
|
+
- spec/test.yml
|
132
|
+
- spec/valid_url.yml
|
133
|
+
homepage: https://github.com/giraldomauricio/propeller
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
metadata: {}
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
require_paths:
|
140
|
+
- lib
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
requirements: []
|
152
|
+
rubyforge_project:
|
153
|
+
rubygems_version: 2.1.11
|
154
|
+
signing_key:
|
155
|
+
specification_version: 4
|
156
|
+
summary: Using a basic Yaml file, Propeller can dispatch parallel request to a number of urls and collects the results in a hash or in a Junit formatted xml
|
157
|
+
test_files:
|
158
|
+
- spec/basic_request_spec.rb
|
159
|
+
- spec/invalid_url.yml
|
160
|
+
- spec/test.yml
|
161
|
+
- spec/valid_url.yml
|