zold-stress 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2018 Yegor Bugayenko
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 NONINFINGEMENT. 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.
22
+
23
+ require 'minitest/autorun'
24
+ require_relative '../test__helper'
25
+ require_relative '../../../lib/zold/stress/stats'
26
+
27
+ class StatsTest < Minitest::Test
28
+ def test_aggregates_metrics
29
+ stats = Zold::Stress::Stats.new
30
+ m = 'metric-1'
31
+ stats.put(m, 0.1)
32
+ stats.put(m, 3.0)
33
+ assert(stats.to_json[m])
34
+ assert_equal(1.55, stats.to_json[m][:avg])
35
+ end
36
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2016-2018 Yegor Bugayenko
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 NONINFINGEMENT. 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.
22
+
23
+ STDOUT.sync = true
24
+
25
+ ENV['RACK_ENV'] = 'test'
26
+
27
+ # require 'simplecov'
28
+ # SimpleCov.start
29
+ # if ENV['CI'] == 'true'
30
+ # require 'codecov'
31
+ # SimpleCov.formatter = SimpleCov::Formatter::Codecov
32
+ # end
33
+
34
+ require 'concurrent'
35
+ require 'minitest/autorun'
36
+ module Minitest
37
+ class Test
38
+ def test_log
39
+ require 'zold/log'
40
+ @test_log ||= Zold::Log::Sync.new(Zold::Log::Verbose.new)
41
+ end
42
+
43
+ def test_opts(*argv)
44
+ Slop.parse(argv + ['--ignore-score-weakness', '--network=test'], suppress_errors: true) do |o|
45
+ o.integer '--pool', default: 3
46
+ o.integer '--rounds', default: 1
47
+ o.integer '--threads', default: Concurrent.processor_count * 2
48
+ o.integer '--batch', default: 4
49
+ o.string '--private-key', default: 'fixtures/id_rsa.pub'
50
+ o.string '--network', default: 'test'
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2018 Yegor Bugayenko
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.
22
+
23
+ require 'English'
24
+ Gem::Specification.new do |s|
25
+ s.specification_version = 2 if s.respond_to? :specification_version=
26
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
+ s.rubygems_version = '2.2'
28
+ s.required_ruby_version = '>=2.3'
29
+ s.name = 'zold-stress'
30
+ s.version = '0.1.0'
31
+ s.license = 'MIT'
32
+ s.summary = 'Zold stress test'
33
+ s.description = 'Stress testing toolkit for Zold network'
34
+ s.authors = ['Yegor Bugayenko']
35
+ s.email = 'yegor256@gmail.com'
36
+ s.homepage = 'http://github.com/zold-io/zold-stress'
37
+ s.files = `git ls-files`.split($RS)
38
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
39
+ s.test_files = s.files.grep(%r{^(test|features)/})
40
+ s.rdoc_options = ['--charset=UTF-8']
41
+ s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
42
+ s.add_runtime_dependency 'backtrace', '0.3.0'
43
+ s.add_runtime_dependency 'parallelize', '0.4.1'
44
+ s.add_runtime_dependency 'zold'
45
+ s.add_development_dependency 'codecov', '0.1.13'
46
+ s.add_development_dependency 'minitest', '5.11.3'
47
+ s.add_development_dependency 'random-port', '0.3.0'
48
+ s.add_development_dependency 'rdoc', '4.3.0'
49
+ s.add_development_dependency 'rspec-rails', '3.8.1'
50
+ s.add_development_dependency 'rubocop', '0.60.0'
51
+ s.add_development_dependency 'rubocop-rspec', '1.30.1'
52
+ end
metadata ADDED
@@ -0,0 +1,230 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zold-stress
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yegor Bugayenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: backtrace
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: parallelize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.4.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: zold
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.1.13
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.1.13
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 5.11.3
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 5.11.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: random-port
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.3.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.3.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rdoc
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 4.3.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 4.3.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 3.8.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 3.8.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 0.60.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.60.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '='
144
+ - !ruby/object:Gem::Version
145
+ version: 1.30.1
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '='
151
+ - !ruby/object:Gem::Version
152
+ version: 1.30.1
153
+ description: Stress testing toolkit for Zold network
154
+ email: yegor256@gmail.com
155
+ executables:
156
+ - zold-stress
157
+ extensions: []
158
+ extra_rdoc_files:
159
+ - README.md
160
+ - LICENSE.txt
161
+ files:
162
+ - ".0pdd.yml"
163
+ - ".gitattributes"
164
+ - ".gitignore"
165
+ - ".pdd"
166
+ - ".rubocop.yml"
167
+ - ".rultor.yml"
168
+ - ".simplecov"
169
+ - ".travis.yml"
170
+ - Gemfile
171
+ - LICENSE.txt
172
+ - README.md
173
+ - Rakefile
174
+ - bin/zold-stress
175
+ - features/cli.feature
176
+ - features/gem_package.feature
177
+ - features/step_definitions/steps.rb
178
+ - features/support/env.rb
179
+ - fixtures/id_rsa
180
+ - fixtures/id_rsa.pub
181
+ - lib/zold/stress/air.rb
182
+ - lib/zold/stress/pmnts.rb
183
+ - lib/zold/stress/pool.rb
184
+ - lib/zold/stress/round.rb
185
+ - lib/zold/stress/stats.rb
186
+ - test/zold/stress/fake_node.rb
187
+ - test/zold/stress/test_air.rb
188
+ - test/zold/stress/test_pmnts.rb
189
+ - test/zold/stress/test_pool.rb
190
+ - test/zold/stress/test_round.rb
191
+ - test/zold/stress/test_stats.rb
192
+ - test/zold/test__helper.rb
193
+ - zold-stress.gemspec
194
+ homepage: http://github.com/zold-io/zold-stress
195
+ licenses:
196
+ - MIT
197
+ metadata: {}
198
+ post_install_message:
199
+ rdoc_options:
200
+ - "--charset=UTF-8"
201
+ require_paths:
202
+ - lib
203
+ required_ruby_version: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ version: '2.3'
208
+ required_rubygems_version: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
213
+ requirements: []
214
+ rubyforge_project:
215
+ rubygems_version: 2.7.6
216
+ signing_key:
217
+ specification_version: 2
218
+ summary: Zold stress test
219
+ test_files:
220
+ - features/cli.feature
221
+ - features/gem_package.feature
222
+ - features/step_definitions/steps.rb
223
+ - features/support/env.rb
224
+ - test/zold/stress/fake_node.rb
225
+ - test/zold/stress/test_air.rb
226
+ - test/zold/stress/test_pmnts.rb
227
+ - test/zold/stress/test_pool.rb
228
+ - test/zold/stress/test_round.rb
229
+ - test/zold/stress/test_stats.rb
230
+ - test/zold/test__helper.rb