3 changes: 3 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fixtures:
symlinks:
registry: "#{source_dir}"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
pkg/
.DS_Store
coverage/
.idea/
*.iml
acceptance/log/*
.vagrant
Gemfile.lock
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
branches:
only:
- master
language: ruby
bundler_args: --without development
script: bundle exec rake spec SPEC_OPTS='--format documentation'
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
env:
matrix:
- PUPPET_GEM_VERSION="~> 2.7.0"
- PUPPET_GEM_VERSION="~> 3.0.0"
- PUPPET_GEM_VERSION="~> 3.1.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.4.0"
matrix:
fast_finish: true
exclude:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 3.2.0"
notifications:
email: false
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
##2014-05-20 - Supported Release 1.0.1
#####Bugfixes
- Add zero padding to binary single character inputs

##2014-03-04 - Supported Release 1.0.0
###Summary
This is a supported release.
Expand Down
33 changes: 33 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

def location_for(place, fake_version = nil)
if place =~ /^(git[:@][^#]*)#(.*)/
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
elsif place =~ /^file:\/\/(.*)/
['>= 0', { :path => File.expand_path($1), :require => false }]
else
[place, { :require => false }]
end
end

group :development, :test do
gem 'rake', :require => false
gem 'mocha', '~>0.10.5', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'serverspec', :require => false
gem 'puppet-lint', :require => false
gem 'pry', :require => false
gem 'simplecov', :require => false
gem 'rspec', '~>2.14.0', :require => false
gem 'beaker', :require => false
end

ENV['GEM_PUPPET_VERSION'] ||= ENV['PUPPET_GEM_VERSION']
puppetversion = ENV['GEM_PUPPET_VERSION']
if puppetversion
gem 'puppet', *location_for(puppetversion)
else
gem 'puppet', :require => false
end

# vim:ft=ruby
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'puppetlabs-registry'
version '1.0.0'
version '1.0.1'
source 'git://github.com/puppetlabs/puppetlabs-registry.git'
author 'puppetlabs'
license 'Apache License, Version 2.0'
Expand Down
3 changes: 2 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#registry
[![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-registry.png?branch=master)](https://travis-ci.org/puppetlabs/puppetlabs-registry)

####Table of Contents

Expand Down Expand Up @@ -297,4 +298,4 @@ We want to keep it as easy as possible to contribute changes so that our modules

You can read the complete module contribution guide [on the Puppet Labs wiki.](http://projects.puppetlabs.com/projects/module-site/wiki/Module_contributing)

Licensed under [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
Licensed under [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
14 changes: 11 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
require 'rake'
require 'rspec/core/rake_task'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'beaker/tasks/test'

#Due to puppet-lint not ignoring tests folder or the ignore paths attribute
#we have to ignore many things
PuppetLint.configuration.ignore_paths = ["tests/*.pp","spec/**/*.pp","pkg/**/*.pp"]
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.send("disable_autoloader_layout")
PuppetLint.configuration.send("disable_double_quoted_strings")

task :default => [:test]

desc 'Run RSpec'
RSpec::Core::RakeTask.new(:test) do |t|
t.pattern = 'spec/{unit}/**/*.rb'
# t.rspec_opts = ['--color']
#t.rspec_opts = ['--color']
end

desc 'Generate code coverage'
Expand Down
12 changes: 12 additions & 0 deletions acceptance/.beaker-pe.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
:load_path => "./acceptance/lib/",
:hosts_file => './acceptance/config/windows-2012-x86_64.cfg',
:type => "pe",
:pre_suite => ['./acceptance/setup/install_pe.rb'],
:tests => "./acceptance/tests",
:pe_dir => "http://neptune.delivery.puppetlabs.net/3.2/ci-ready",
:debug => true,
:timeout => 6000,
:ntp => true,
:keyfile => "~/.ssh/id_rsa-acceptance"
}
23 changes: 23 additions & 0 deletions acceptance/config/windows-2003r2-i386.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
HOSTS:
ubuntu1204:
roles:
- master
- database
- dashboard
platform: ubuntu-12.04-amd64
template: ubuntu-1204-x86_64
hypervisor: vcloud
w2k3r2:
roles:
- agent
platform: windows-2003r2-i386
template: win-2003r2-i386
hypervisor: vcloud
CONFIG:
pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/FOSS/Dynamic
resourcepool: delivery/Quality Assurance/FOSS/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
23 changes: 23 additions & 0 deletions acceptance/config/windows-2003r2-x86_64.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
HOSTS:
ubuntu1204:
roles:
- master
- database
- dashboard
platform: ubuntu-12.04-amd64
template: ubuntu-1204-x86_64
hypervisor: vcloud
w2k3r2:
roles:
- agent
platform: windows-2003r2-x86_64
template: win-2003r2-x86_64
hypervisor: vcloud
CONFIG:
pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/FOSS/Dynamic
resourcepool: delivery/Quality Assurance/FOSS/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
23 changes: 23 additions & 0 deletions acceptance/config/windows-2008r2-x86_64.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
HOSTS:
ubuntu1204:
roles:
- master
- database
- dashboard
platform: ubuntu-12.04-amd64
template: ubuntu-1204-x86_64
hypervisor: vcloud
w2k8r2:
roles:
- agent
platform: windows-2008r2-x86_64
template: win-2008r2-x86_64
hypervisor: vcloud
pe_dir: http://neptune.puppetlabs.lan/3.2/ci-ready/
CONFIG:
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/FOSS/Dynamic
resourcepool: delivery/Quality Assurance/FOSS/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
23 changes: 23 additions & 0 deletions acceptance/config/windows-2012-x86_64.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
HOSTS:
ubuntu1204:
roles:
- master
- database
- dashboard
platform: ubuntu-12.04-amd64
template: ubuntu-1204-x86_64
hypervisor: vcloud
w2012:
roles:
- agent
- default
platform: windows-2012-x86_64
template: win-2012-x86_64
hypervisor: vcloud
CONFIG:
nfs_server: none
consoleport: 443
datastore: instance0
folder: Delivery/Quality Assurance/FOSS/Dynamic
resourcepool: delivery/Quality Assurance/FOSS/Dynamic
pooling_api: http://vcloud.delivery.puppetlabs.net/
37 changes: 35 additions & 2 deletions acceptance/lib/systest/util/registry.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'pathname'

require Pathname.new(__FILE__).dirname
# This module is meant to be mixed into the individual test cases for the
# registry module.
Expand Down Expand Up @@ -82,6 +83,14 @@ def master_options
"--modulepath=\"#{get_test_file_path(master, master_module_dir)}\" " +
"--autosign true --pluginsync"
end
def master_options_hash
@master_options_hash ||= {
:manifest => "#{get_test_file_path(master, master_manifest_file)}",
:modulepath => "#{get_test_file_path(master, master_module_dir)} ",
:autosign => true,
:pluginsync => true
}
end

def agent_exit_codes
# legal exit codes whenever we run the agent
Expand Down Expand Up @@ -143,25 +152,49 @@ def create_test_file(host, file_rel_path, file_content, options)
chown(host, options[:owner], options[:group], file_path)
chmod(host, options[:mode], file_path)
end

def puppet_module_install(host = nil, source = nil, module_name = nil, module_path = '/etc/puppet/modules')
opts = {:source => source, :module_name => module_name,:target_module_path => module_path}
copy_root_module_to(host,opts)
end
def setup_master(master_manifest_content="# Intentionally Blank\n")
step "Setup Puppet Master Manifest" do
proj_root = File.expand_path(File.join(File.dirname(__FILE__),'../../../../'))
masters.each do |host|
puppet_module_install(host,proj_root,'registry',File.join(host['puppetpath'],"modules"))
create_test_file(host, master_manifest_file, master_manifest_content, :mkdirs => true)
puppet_conf_update_ini = <<-MANIFEST
ini_setting{'Update Puppet.Conf':
ensure => present,
section => 'main',
key_val_separator => '=',
path => '#{host['puppetpath']}/puppet.conf',
setting => 'manifestdir',
value => '#{host_test_tmp_dirs[host.name]}/master_manifest/' }
MANIFEST
on host, puppet('apply','--debug'), :stdin => puppet_conf_update_ini
end
end
step "Symlink the module(s) into the master modulepath" do
masters.each do |host|
moddir = get_test_file_path(host, master_module_dir)
mkdirs(host, moddir)
on host, "ln -s /opt/puppet-git-repos/stdlib \"#{moddir}/stdlib\"; ln -s /opt/puppet-git-repos/registry \"#{moddir}/registry\""
#on host, "ln -s /opt/puppet-git-repos/stdlib \"#{moddir}/stdlib\"; ln -s /opt/puppet-git-repos/registry \"#{moddir}/registry\""
end
end
end

def clean_up
step "Clean Up" do
masters.each do |host|
puppet_conf_update_ini = <<-MANIFEST
ini_setting{'Revert Puppet.Conf':
ensure => absent,
section => 'main',
key_val_separator => '=',
path => '#{host['puppetpath']}/puppet.conf',
setting => 'manifestdir' }
MANIFEST
on host, puppet('apply','--debug'), :stdin => puppet_conf_update_ini
on host, "rm -rf \"%s\"" % get_test_file_path(host, '')
end
agents.each do |host|
Expand Down
3 changes: 3 additions & 0 deletions acceptance/setup/install_pe.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test_name "Installing Puppet Enterprise" do
install_pe
end
7 changes: 4 additions & 3 deletions acceptance/tests/resource/registry/should_create_key.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'tempfile'
require 'pathname'
require Pathname.new(__FILE__).dirname.dirname.dirname.dirname + 'lib/systest/util/registry'
require 'systest/util/registry'
# Include our utility methods in the singleton class of the test case instance.
class << self
include Systest::Util::Registry
Expand Down Expand Up @@ -85,10 +85,11 @@ class phase3 {
HERE

# Setup the master to use the modules specified in the --modules option
setup_master master_manifest_content


step "Start the master" do
with_master_running_on(master, master_options) do
setup_master master_manifest_content
with_puppet_running_on master, :__commandline_args__ => master_options do
# A set of keys we expect Puppet to create
keys_created_native = [
/Registry_key\[HKLM.Software.Vendor.PuppetLabsTest\w+\].ensure: created/,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'pathname'
require Pathname.new(__FILE__).dirname.dirname.dirname.dirname + 'lib/systest/util/registry'
require 'systest/util/registry'
# Include our utility methods in the singleton class of the test case instance.
class << self
include Systest::Util::Registry
Expand Down Expand Up @@ -49,7 +49,8 @@ class phase1 {
setup_master master_manifest_content

step "Start the master" do
with_master_running_on(master, master_options) do
with_puppet_running_on master, :__commandline_args__ => master_options do

# A set of keys we expect Puppet to create
phase1_resources_created = [
/Registry_key\[HKLM.Software.Vendor.PuppetLabsTest\w+\].ensure: created/,
Expand Down
6 changes: 3 additions & 3 deletions acceptance/tests/resource/registry/should_manage_values.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'pathname'
require Pathname.new(__FILE__).dirname.dirname.dirname.dirname + 'lib/systest/util/registry'
require 'systest/util/registry'
# Include our utility methods in the singleton class of the test case instance.
class << self
include Systest::Util::Registry
Expand Down Expand Up @@ -184,7 +184,7 @@ class phase1 {
# Binary Values
registry_value { '#{keypath}\\SubKey1\\ValueBinary1':
type => binary,
data => "0${::fact_phase}",
data => "${::fact_phase}",
}
registry_value { '#{keypath}\\SubKey1\\ValueBinary2':
type => binary,
Expand Down Expand Up @@ -215,7 +215,7 @@ class phase1 {
setup_master master_manifest_content

step "Start the master" do
with_master_running_on(master, master_options) do
with_puppet_running_on master, :__commandline_args__ => master_options do
windows_agents.each do |agent|
this_agent_args = agent_args % get_test_file_path(agent, agent_lib_dir)
x64 = x64?(agent)
Expand Down
4 changes: 2 additions & 2 deletions acceptance/tests/resource/registry/should_pluginsync.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'pathname'
require Pathname.new(__FILE__).dirname.dirname.dirname.dirname + 'lib/systest/util/registry'
require 'systest/util/registry'
# Include our utility methods in the singleton class of the test case instance.
class << self
include Systest::Util::Registry
Expand All @@ -14,7 +14,7 @@ class << self
setup_master master_manifest_content

step "Start the master and test pluginsync" do
with_master_running_on(master, master_options) do
with_puppet_running_on master, :__commandline_args__ => master_options do
windows_agents.each do |agent|
this_agent_args = agent_args % get_test_file_path(agent, agent_lib_dir)
run_agent_on(agent, this_agent_args, :acceptable_exit_codes => agent_exit_codes) do
Expand Down
Loading