beaker-benchmark 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +6 -1
- data/beaker-benchmark.gemspec +3 -3
- data/lib/beaker-benchmark/helpers.rb +6 -6
- data/lib/beaker-benchmark/version.rb +1 -1
- data/spec/beaker-benchmark/performance_result_spec.rb +6 -6
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3d364c9ffbb33d937c20b19d76c5cd038605dd3f051ff0c2b333a338086e7fc1
|
4
|
+
data.tar.gz: ee0585b80157575a778fc3f153ee8798e219c825ae7bf9690124683a758d403a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74f817474f7eafbe19c40cd91461eb7d380fa29a2daf244d611e56a8818817d5716e5e295ccf88db9db92e48d0ddce38bf1af2ba164fded979546b8c5031f95c
|
7
|
+
data.tar.gz: dcc8cdfbf6b07857348f6565b034405f50a2a9c31b65ee974d1fa9ce2193a980d8fa32b555ddcc17fb22a0849f0e27077424f8bfcd1fa9dd827e686403018da4
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "rspec/core/rake_task"
|
2
2
|
|
3
3
|
namespace :test do
|
4
4
|
|
@@ -152,3 +152,8 @@ namespace :docs do
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
155
|
+
|
156
|
+
namespace :gem do
|
157
|
+
# add the Bundler gem tasks (build, clean, clobber, install, release)
|
158
|
+
require "bundler/gem_tasks"
|
159
|
+
end
|
data/beaker-benchmark.gemspec
CHANGED
@@ -5,12 +5,12 @@ require 'beaker-benchmark/version'
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "beaker-benchmark"
|
7
7
|
s.version = Beaker::DSL::BeakerBenchmark::Version::STRING
|
8
|
-
s.authors = ["
|
9
|
-
s.email = ["
|
8
|
+
s.authors = ["Puppet"]
|
9
|
+
s.email = ["team-system-level-validation@puppet.com"]
|
10
10
|
s.homepage = "https://github.com/puppetlabs/beaker-benchmark"
|
11
11
|
s.summary = %q{Beaker benchmark Helpers!}
|
12
12
|
s.description = %q{Used to monitor performance on a puppet infrastructure node in a Beaker test}
|
13
|
-
s.license =
|
13
|
+
s.license = "Apache-2.0"
|
14
14
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -33,7 +33,7 @@ module Beaker
|
|
33
33
|
|
34
34
|
TMP_DIR = "tmp/atop/#{@@session_timestamp}"
|
35
35
|
|
36
|
-
|
36
|
+
# Example usage:
|
37
37
|
# test_name('measure_perf_on_puppetserver_start') {
|
38
38
|
# on(master, 'puppet resource service pe-puppetserver ensure=stopped')
|
39
39
|
# result = measure_perf_on(master, 'start_pe-puppetserver', true) {
|
@@ -135,13 +135,13 @@ module Beaker
|
|
135
135
|
when 'PRM'
|
136
136
|
add_process_measure(:mem_usage, row[PROC_PID_INDEX], row[PROC_MEM_INDEX].to_i)
|
137
137
|
when 'PRD'
|
138
|
-
|
139
|
-
# add_process_measure(:disk_read, row[PROC_PID_INDEX], row[PROC_DISK_READ_INDEX].to_i)
|
138
|
+
add_process_measure(:disk_read, row[PROC_PID_INDEX], row[PROC_DISK_READ_INDEX].to_i)
|
140
139
|
add_process_measure(:disk_write, row[PROC_PID_INDEX], row[PROC_DISK_WRITE_INDEX].to_i)
|
141
140
|
end
|
142
141
|
end
|
143
142
|
|
144
|
-
|
143
|
+
# rounding duration to improve results formatting
|
144
|
+
PerformanceResult.new({ :cpu => cpu_usage, :mem => mem_usage, :disk_read => disk_read, :disk_write => disk_write, :action => @action_name, :duration => duration.round(2), :processes => @processes_to_monitor, :logger => @logger, :hostname => infrastructure_host})
|
145
145
|
end
|
146
146
|
|
147
147
|
def set_processes_to_monitor(infrastructure_host, process_regex)
|
@@ -174,7 +174,7 @@ module Beaker
|
|
174
174
|
def initialize(args)
|
175
175
|
@avg_cpu = args[:cpu].empty? ? 0 : args[:cpu].inject{ |sum, el| sum + el } / args[:cpu].size
|
176
176
|
@avg_mem = args[:mem].empty? ? 0 : args[:mem].inject{ |sum, el| sum + el } / args[:mem].size
|
177
|
-
|
177
|
+
@avg_disk_read = args[:disk_read].empty? ? 0 : args[:disk_read].inject{ |sum, el| sum + el } / args[:disk_read].size
|
178
178
|
@avg_disk_write = args[:disk_write].empty? ? 0 : args[:disk_write].inject{ |sum, el| sum + el } / args[:disk_write].size
|
179
179
|
@action_name = args[:action]
|
180
180
|
@duration = args[:duration]
|
@@ -186,7 +186,7 @@ module Beaker
|
|
186
186
|
@processes.keys.each do |key|
|
187
187
|
@processes[key][:avg_cpu] = @processes[key][:cpu_usage].inject{ |sum, el| sum + el } / @processes[key][:cpu_usage].size unless @processes[key][:cpu_usage].empty?
|
188
188
|
@processes[key][:avg_mem] = @processes[key][:mem_usage].inject{ |sum, el| sum + el } / @processes[key][:mem_usage].size unless @processes[key][:mem_usage].empty?
|
189
|
-
|
189
|
+
@processes[key][:avg_disk_read] = @processes[key][:disk_read].inject{ |sum, el| sum + el } / @processes[key][:disk_read].size unless @processes[key][:disk_read].empty?
|
190
190
|
@processes[key][:avg_disk_write] = @processes[key][:disk_write].inject{ |sum, el| sum + el } / @processes[key][:disk_write].size unless @processes[key][:disk_write].empty?
|
191
191
|
end if @processes
|
192
192
|
# TODO: At this point, we need to push these results into bigquery or elasticsearch
|
@@ -12,9 +12,9 @@ end
|
|
12
12
|
|
13
13
|
describe ClassMixedWithDSLHelpers do
|
14
14
|
subject { Beaker::DSL::BeakerBenchmark::Helpers::PerformanceResult.new (
|
15
|
-
{:cpu => [60, 40], :mem => [6000, 4000], :disk_write => [600, 400], :action => 'test_action', :duration => 10,
|
16
|
-
:processes => {1000 => {:cmd => 'proc1', :cpu_usage => [10, 20], :mem_usage => [1000, 2000], :disk_write => [100, 200]},
|
17
|
-
2000 => {:cmd => 'proc2', :cpu_usage => [20, 40], :mem_usage => [2000, 4000], :disk_write => [200, 400]}},
|
15
|
+
{:cpu => [60, 40], :mem => [6000, 4000], :disk_read => [600, 400], :disk_write => [600, 400], :action => 'test_action', :duration => 10,
|
16
|
+
:processes => {1000 => {:cmd => 'proc1', :cpu_usage => [10, 20], :mem_usage => [1000, 2000], :disk_read => [100, 200], :disk_write => [100, 200]},
|
17
|
+
2000 => {:cmd => 'proc2', :cpu_usage => [20, 40], :mem_usage => [2000, 4000], :disk_read => [200, 400], :disk_write => [200, 400]}},
|
18
18
|
:logger => logger, :hostname => 'my_host'}) }
|
19
19
|
|
20
20
|
describe 'initialize' do
|
@@ -57,11 +57,11 @@ describe ClassMixedWithDSLHelpers do
|
|
57
57
|
csv_file_content = file.read
|
58
58
|
expected_content = <<-EOS
|
59
59
|
Action,Duration,Avg CPU,Avg MEM,Avg DSK read,Avg DSK Write
|
60
|
-
test_action,10,50,5000
|
60
|
+
test_action,10,50,5000,500,500
|
61
61
|
|
62
62
|
Process pid,command,Avg CPU,Avg MEM,Avg DSK read,Avg DSK Write
|
63
|
-
1000,'proc1',15,1500
|
64
|
-
2000,'proc2',30,3000
|
63
|
+
1000,'proc1',15,1500,150,150
|
64
|
+
2000,'proc2',30,3000,300,300
|
65
65
|
EOS
|
66
66
|
expect(csv_file_content).to eq(expected_content)
|
67
67
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-benchmark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -153,7 +153,7 @@ dependencies:
|
|
153
153
|
description: Used to monitor performance on a puppet infrastructure node in a Beaker
|
154
154
|
test
|
155
155
|
email:
|
156
|
-
-
|
156
|
+
- team-system-level-validation@puppet.com
|
157
157
|
executables:
|
158
158
|
- beaker-benchmark
|
159
159
|
extensions: []
|
@@ -181,7 +181,7 @@ files:
|
|
181
181
|
- spec/spec_helper.rb
|
182
182
|
homepage: https://github.com/puppetlabs/beaker-benchmark
|
183
183
|
licenses:
|
184
|
-
-
|
184
|
+
- Apache-2.0
|
185
185
|
metadata: {}
|
186
186
|
post_install_message:
|
187
187
|
rdoc_options: []
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: '0'
|
200
200
|
requirements: []
|
201
201
|
rubyforge_project:
|
202
|
-
rubygems_version: 2.
|
202
|
+
rubygems_version: 2.7.3
|
203
203
|
signing_key:
|
204
204
|
specification_version: 4
|
205
205
|
summary: Beaker benchmark Helpers!
|