facter-statistax 0.0.1 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -1
- data/.rubycritic.yml +1 -0
- data/CODEOWNERS +2 -0
- data/README.md +2 -0
- data/acceptance/.beaker.yml +15 -0
- data/acceptance/Gemfile +34 -0
- data/acceptance/README.md +20 -0
- data/acceptance/config.json +23 -0
- data/acceptance/config/aio/options.rb +5 -0
- data/acceptance/lib/helper.rb +5 -0
- data/acceptance/presuite/011_install_facter_ng.rb +17 -0
- data/acceptance/presuite/01_install_puppet_agent.rb +23 -0
- data/acceptance/presuite/02_install_facter_statistax.rb +8 -0
- data/acceptance/presuite/03_install_facter_gem.rb +12 -0
- data/acceptance/run/run_facter_ng.rb +16 -0
- data/acceptance/run/run_statistax.rb +31 -0
- data/acceptance/run/uninstall_facter_gem.rb +8 -0
- data/acceptance/run/uninstall_puppet_agent.rb +7 -0
- data/config/boot.rb +3 -3
- data/facter-statistax.gemspec +3 -2
- data/lib/common/output_writer.rb +1 -1
- data/lib/executors/test_run_executor.rb +3 -3
- data/lib/version.rb +5 -0
- data/scripts/benchmark_script.rb +7 -12
- metadata +21 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0552de16514e7b424dfdacd4c2b9cb838ea7a48cd35995f91dfb0a6dfdc071ed
|
4
|
+
data.tar.gz: '00589c61b9d246492ce72be06863e4e6f323d6fc9ca21aa8e3c4e283203d6c61'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a25819a961daf64421b92e2dba2a77589ba2f01a08a3bb6d43b8c7b5b4ab3e241706e5d650ea0d1a73fff2b1256cffd6863fc5b158924643718e9a028db2f4c4
|
7
|
+
data.tar.gz: d12bad1c4b1c4419e4a68cf7bbd4ab8e12097843ced39a8dbaedc6dd73d5541ef92cb84e9c9ad875b7c3eee7a89de694529ea55e070dad6109e1eb5316ce281f
|
data/.rubocop.yml
CHANGED
data/.rubycritic.yml
CHANGED
data/CODEOWNERS
ADDED
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# facter-statistax
|
2
|
+
[![Build Status](https://travis-ci.com/puppetlabs/facter-statistax.svg?branch=master)](https://travis-ci.com/puppetlabs/facter-statistax)
|
3
|
+
|
2
4
|
Benchmark tool for different versions of Puppet Facter.
|
3
5
|
|
4
6
|
In order to run this script you must create a 'config.json' file with the following format:
|
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
ssh:
|
3
|
+
keys:
|
4
|
+
- id_rsa_acceptance
|
5
|
+
- ~/.ssh/id_rsa-acceptance
|
6
|
+
xml: true
|
7
|
+
timesync: false
|
8
|
+
repo_proxy: true
|
9
|
+
add_el_extras: false
|
10
|
+
forge_host: api-forge-aio02-petest.puppet.com
|
11
|
+
'master-start-curl-retries': 30
|
12
|
+
log_level: debug
|
13
|
+
preserve_hosts: onfail
|
14
|
+
helper: ./lib/helper.rb
|
15
|
+
options_file: ./config/aio/options.rb
|
data/acceptance/Gemfile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Specifies a gem mirror; duplicated in acceptance setup
|
2
|
+
# to ensure a similar environment on acceptance hosts.
|
3
|
+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
4
|
+
|
5
|
+
def location_for(place, fake_version = nil)
|
6
|
+
if place =~ /^(git:[^#]*)#(.*)/
|
7
|
+
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
|
8
|
+
elsif place =~ /^file:\/\/(.*)/
|
9
|
+
['>= 0', { :path => File.expand_path($1), :require => false }]
|
10
|
+
else
|
11
|
+
[place, { :require => false }]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0')
|
16
|
+
gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || ["~>1.0", ">= 1.18.4"])
|
17
|
+
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || "~> 1.1")
|
18
|
+
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || "~> 0.4")
|
19
|
+
gem "beaker-vagrant", *location_for(ENV['BEAKER_VAGRANT_VERSION'] || "~> 0")
|
20
|
+
gem "beaker-vmpooler", *location_for(ENV['BEAKER_VMPOOLER_VERSION'] || "~> 1.3")
|
21
|
+
gem "beaker-vcloud", *location_for(ENV['BEAKER_VCLOUD_VERSION'] || "~> 1.0")
|
22
|
+
gem "beaker-docker", *location_for(ENV['BEAKER_DOCKER_VERSION'] || "~> 0.5")
|
23
|
+
gem "rake", "~> 10.1"
|
24
|
+
gem "httparty", :require => false
|
25
|
+
gem 'uuidtools', :require => false
|
26
|
+
|
27
|
+
group(:test) do
|
28
|
+
gem "rspec", "~> 2.14.0", :require => false
|
29
|
+
gem "mocha", "~> 0.10.5", :require => false
|
30
|
+
end
|
31
|
+
|
32
|
+
if File.exists? "#{__FILE__}.local"
|
33
|
+
eval(File.read("#{__FILE__}.local"), binding)
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Steps for collecting facter statistics
|
2
|
+
|
3
|
+
1. ```bundle install```
|
4
|
+
2. ```export SHA=6.0.9``` - puppet agent SHA/VERSION to be installed and tested (please note that this projects
|
5
|
+
is working with puppet agent >= 6.0.x)
|
6
|
+
3. ```export GEM_VERSION=2.5.5``` - gem facter version you want to test (if this env variable isn't set, the latest
|
7
|
+
version will be downloaded)
|
8
|
+
4. ```export IS_GEM=true\false``` - it will indicate which facter to test ruby\cpp version (if this isn't set, cpp
|
9
|
+
facter will be tested)
|
10
|
+
5. Modify config.json from acceptance directory to meet your testing needs
|
11
|
+
6. To test using vmpooler:\
|
12
|
+
```beaker-hostgenerator redhat7-64a-debian9-64a > hosts.yaml```\
|
13
|
+
```beaker init -h hosts.yaml --options-file config/aio/options.rb```\
|
14
|
+
To test using nspooler you have to require the vm from nspooler first, then:\
|
15
|
+
```beaker-hostgenerator centos6-64a-solaris11-SPARC\{hypervisor=none\,hostname=$THE_HOST_NSPOOLER_PROVIDED\} > hosts.yaml```\
|
16
|
+
```bundle exec beaker init --hosts hosts.yaml --options-file config/aio/options.rb```
|
17
|
+
7. ```bundle exec beaker provision```
|
18
|
+
8. ```bundle exec beaker exec pre-suite --pre-suite presuite/01_install_puppet_agent.rb,presuite/02_install_facter_statistax.rb,presuite/03_install_facter_gem.rb --preserve-state```
|
19
|
+
9. Before this step you can set/unset ```IS_GEM env``` variable to meet your test needs\
|
20
|
+
```bundle exec beaker exec run/run_statistax.rb```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"test_run":"TestRun1",
|
4
|
+
"runs":[
|
5
|
+
{
|
6
|
+
"fact":"os",
|
7
|
+
"repetitions":3
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"fact":"processors",
|
11
|
+
"repetitions":1
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"fact":"virtual",
|
15
|
+
"repetitions":3
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"fact":"all",
|
19
|
+
"repetitions":3
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
23
|
+
]
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
test_name 'Install facter gem' do
|
4
|
+
agents.each do |agent|
|
5
|
+
facter_gem = File.join(Pathname.new(File.expand_path('..', __dir__)), 'facter-ng-0.0.10.gem')
|
6
|
+
home_dir = on(agent, 'pwd').stdout.chop
|
7
|
+
|
8
|
+
scp_to agent, facter_gem, home_dir
|
9
|
+
|
10
|
+
gem_c = gem_command(agent)
|
11
|
+
on agent, "#{gem_c} install -f facter-ng-0.0.10.gem"
|
12
|
+
if agent['platform'] =~ /windows/
|
13
|
+
puppetbin_path = '"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/puppet/bin":"/cygdrive/c/Program Files/Puppet Labs/Puppet/puppet/bin"'
|
14
|
+
on agent, %( echo 'export PATH=$PATH:#{puppetbin_path}' > /etc/bash.bashrc )
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
test_name 'Install Puppet Agent Packages' do
|
4
|
+
opts = {
|
5
|
+
nightly_builds_url: ENV['NIGHTLY_BUILDS_URL'],
|
6
|
+
dev_builds_url: ENV['DEV_BUILDS_URL'],
|
7
|
+
puppet_agent_version: ENV['SHA'],
|
8
|
+
puppet_collection: ENV['RELEASE_STREAM']
|
9
|
+
}
|
10
|
+
|
11
|
+
install_puppet_agent_on(hosts, opts)
|
12
|
+
|
13
|
+
agents.each do |agent|
|
14
|
+
on agent, puppet('--version')
|
15
|
+
ruby = ruby_command(agent)
|
16
|
+
on agent, "#{ruby} --version"
|
17
|
+
|
18
|
+
log_dir = File.join(Pathname.new(File.expand_path('..', __dir__)), 'log_dir')
|
19
|
+
FileUtils.mkdir_p(log_dir)
|
20
|
+
host_dir = File.join(log_dir, agent['platform'])
|
21
|
+
FileUtils.mkdir_p(host_dir)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
test_name 'Install facter gem' do
|
4
|
+
agents.each do |agent|
|
5
|
+
gem_c = gem_command(agent)
|
6
|
+
if ENV['GEM_VERSION']
|
7
|
+
on agent, "#{gem_c} install -f facter-ng -v #{ENV['GEM_VERSION']}"
|
8
|
+
else
|
9
|
+
on agent, "#{gem_c} install -f facter-ng"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
test_name 'Run facter-ng gem' do
|
4
|
+
agents.each do |agent|
|
5
|
+
ruby = ruby_command(agent)
|
6
|
+
if agent['platform'] =~ /windows/
|
7
|
+
puppetbin_path = '"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/puppet/bin":"/cygdrive/c/Program Files/Puppet Labs/Puppet/puppet/bin"'
|
8
|
+
on agent, %( echo 'export PATH=$PATH:#{puppetbin_path}' > /etc/bash.bashrc )
|
9
|
+
end
|
10
|
+
# on agent, 'cd "C:\Program Files\Puppet Labs\Puppet\puppet\lib\ruby\gems\2.5.0\gems\facter-0.0.1"'
|
11
|
+
on(agent, 'pwd').stdout.chop
|
12
|
+
# on agent, ruby.to_s + ' "C:\Program Files\Puppet Labs\Puppet\puppet\lib\ruby\gems\2.5.0\gems\facter-0.0.1\bin\facter"'
|
13
|
+
on agent, ruby.to_s + ' /opt/puppetlabs/puppet/lib/ruby/gems/2.5.0/gems/facter-0.0.1/bin/facter'
|
14
|
+
on agent, 'facter'
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
test_name 'Run facter statistax' do
|
5
|
+
agents.each do |agent|
|
6
|
+
is_gem = ENV['IS_GEM'] || 'false'
|
7
|
+
home_dir = on(agent, 'pwd').stdout.chop
|
8
|
+
step 'Run facter statistax' do
|
9
|
+
content = ::File.read(File.join(Pathname.new(File.expand_path('..', __dir__)), 'config.json'))
|
10
|
+
create_remote_file(agent, "#{home_dir}/config.json", content)
|
11
|
+
if agent['platform'] =~ /windows/
|
12
|
+
puppetbin_path = '"/cygdrive/c/Program Files (x86)/Puppet Labs/Puppet/puppet/bin":"/cygdrive/c/Program Files/Puppet Labs/Puppet/puppet/bin"'
|
13
|
+
on agent, %( echo 'export PATH=$PATH:#{puppetbin_path}' > /etc/bash.bashrc )
|
14
|
+
on agent, "statistax.bat config.json #{is_gem}"
|
15
|
+
else
|
16
|
+
on agent, "statistax #{home_dir}/config.json #{is_gem}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
step 'Save output' do
|
21
|
+
host_dir = File.join(Pathname.new(File.expand_path('..', __dir__)), "log_dir/#{agent['platform']}")
|
22
|
+
|
23
|
+
out_dir = if is_gem == 'true'
|
24
|
+
File.join(host_dir, 'gem')
|
25
|
+
else
|
26
|
+
File.join(host_dir, 'cpp')
|
27
|
+
end
|
28
|
+
scp_from agent, "#{home_dir}/log/output.json", out_dir
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/config/boot.rb
CHANGED
@@ -10,7 +10,7 @@ require_relative '../lib/logger'
|
|
10
10
|
ROOT_DIR = Pathname.new(File.expand_path('..', __dir__)) unless defined?(ROOT_DIR)
|
11
11
|
LOG_DIR = File.join(Dir.getwd, 'log')
|
12
12
|
SCRIPTS_DIR = ROOT_DIR.join('scripts')
|
13
|
-
CONFIG_FILE = ARGV[0] ||
|
13
|
+
CONFIG_FILE = ARGV[0] || ''
|
14
14
|
IS_GEM = ARGV[1] || 'false'
|
15
15
|
|
16
16
|
def load_files(*dirs)
|
@@ -18,6 +18,6 @@ def load_files(*dirs)
|
|
18
18
|
end
|
19
19
|
|
20
20
|
load_files(
|
21
|
-
|
22
|
-
|
21
|
+
'lib/common/*.rb',
|
22
|
+
'lib/executors/*.rb'
|
23
23
|
)
|
data/facter-statistax.gemspec
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# # -*- encoding: utf-8 -*-
|
2
2
|
# frozen_string_literal: true
|
3
|
+
require File.expand_path('../lib/version', __FILE__)
|
3
4
|
|
4
5
|
Gem::Specification.new do |s|
|
5
6
|
s.name = "facter-statistax"
|
6
|
-
s.version =
|
7
|
+
s.version = FacterStatistax::VERSION
|
7
8
|
|
8
9
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
10
|
s.authors = [""]
|
@@ -18,7 +19,7 @@ Gem::Specification.new do |s|
|
|
18
19
|
s.rubyforge_project = "facter-statistax"
|
19
20
|
s.summary = "Facter-Statistax, benchmark for facter"
|
20
21
|
|
21
|
-
s.add_dependency
|
22
|
+
s.add_dependency('logger', ["< 1.4.0"])
|
22
23
|
s.add_dependency 'fileutils'
|
23
24
|
s.add_dependency 'rubysl-open3'
|
24
25
|
s.add_dependency 'json'
|
data/lib/common/output_writer.rb
CHANGED
@@ -12,9 +12,9 @@ module FacterStatistax
|
|
12
12
|
|
13
13
|
def execute
|
14
14
|
sum = sum_for_each_repetition do
|
15
|
-
time, _status = Open3.capture2("ruby #{SCRIPTS_DIR}/benchmark_script.rb #{IS_GEM} #{fact}")
|
15
|
+
time, _status = Open3.capture2("ruby \"#{SCRIPTS_DIR}/benchmark_script.rb\" #{IS_GEM} #{fact}")
|
16
16
|
log_time(fact, time)
|
17
|
-
time.
|
17
|
+
time.to_f
|
18
18
|
end
|
19
19
|
Common::OutputWriter.instance.write_run(fact, sum / repetitions)
|
20
20
|
end
|
@@ -32,7 +32,7 @@ module FacterStatistax
|
|
32
32
|
|
33
33
|
def log_time(fact, time)
|
34
34
|
FacterStatistax.logger.info("For #{fact} facts it took:")
|
35
|
-
FacterStatistax.logger.info("#{format('
|
35
|
+
FacterStatistax.logger.info("#{format('%<time>.2f', time: time)}s")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/version.rb
ADDED
data/scripts/benchmark_script.rb
CHANGED
@@ -5,21 +5,18 @@ require 'open3'
|
|
5
5
|
|
6
6
|
if ARGV[0].to_s == 'false'
|
7
7
|
if Gem.win_platform?
|
8
|
-
facter_dir =
|
9
|
-
ENV['PATH'] = "#{
|
10
|
-
require "#{facter_dir}/
|
8
|
+
facter_dir = 'C:/Program Files/Puppet Labs/Puppet/puppet/bin'
|
9
|
+
ENV['PATH'] = "#{facter_dir}#{File::PATH_SEPARATOR}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
10
|
+
require "#{facter_dir}/libfacter.so"
|
11
11
|
else
|
12
|
-
require
|
12
|
+
require '/opt/puppetlabs/puppet/lib/libfacter.so'
|
13
13
|
end
|
14
|
+
elsif Gem.win_platform?
|
15
|
+
require 'C:\Program Files\Puppet Labs\Puppet\puppet\lib\ruby\gems\2.5.0\gems\facter-ng-0.0.10\lib\facter-ng.rb'
|
14
16
|
else
|
15
|
-
|
16
|
-
require 'C:\Program Files\Puppet Labs\Puppet\puppet\lib\ruby\gems\2.5.0\gems\facter-2.5.5-x64-mingw32\lib\facter.rb'
|
17
|
-
else
|
18
|
-
require 'facter'
|
19
|
-
end
|
17
|
+
require 'facter-ng'
|
20
18
|
end
|
21
19
|
|
22
|
-
|
23
20
|
time = Benchmark.realtime do
|
24
21
|
if ARGV[1] == 'all'
|
25
22
|
Facter.to_hash
|
@@ -29,5 +26,3 @@ time = Benchmark.realtime do
|
|
29
26
|
end
|
30
27
|
|
31
28
|
puts time
|
32
|
-
|
33
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facter-statistax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: logger
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "<"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "<"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: fileutils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,9 +77,24 @@ files:
|
|
77
77
|
- ".rubocop.yml"
|
78
78
|
- ".rubycritic.yml"
|
79
79
|
- ".travis.yml"
|
80
|
+
- CODEOWNERS
|
80
81
|
- Gemfile
|
81
82
|
- LICENSE
|
82
83
|
- README.md
|
84
|
+
- acceptance/.beaker.yml
|
85
|
+
- acceptance/Gemfile
|
86
|
+
- acceptance/README.md
|
87
|
+
- acceptance/config.json
|
88
|
+
- acceptance/config/aio/options.rb
|
89
|
+
- acceptance/lib/helper.rb
|
90
|
+
- acceptance/presuite/011_install_facter_ng.rb
|
91
|
+
- acceptance/presuite/01_install_puppet_agent.rb
|
92
|
+
- acceptance/presuite/02_install_facter_statistax.rb
|
93
|
+
- acceptance/presuite/03_install_facter_gem.rb
|
94
|
+
- acceptance/run/run_facter_ng.rb
|
95
|
+
- acceptance/run/run_statistax.rb
|
96
|
+
- acceptance/run/uninstall_facter_gem.rb
|
97
|
+
- acceptance/run/uninstall_puppet_agent.rb
|
83
98
|
- bin/statistax
|
84
99
|
- config/boot.rb
|
85
100
|
- facter-statistax.gemspec
|
@@ -88,6 +103,7 @@ files:
|
|
88
103
|
- lib/executors/executor.rb
|
89
104
|
- lib/executors/test_run_executor.rb
|
90
105
|
- lib/logger.rb
|
106
|
+
- lib/version.rb
|
91
107
|
- scripts/benchmark_script.rb
|
92
108
|
homepage: ''
|
93
109
|
licenses: []
|