Merge pull request #13 from hkenney/issue/master/pdoc9_add-full-system-test
(PDOC-9) Add full system test
This commit is contained in:
commit
67c42a2f49
|
@ -20,3 +20,6 @@ Gemfile.lock
|
|||
|
||||
## YARD
|
||||
.yardoc
|
||||
|
||||
## MODULE BUILDS
|
||||
**/pkg
|
||||
|
|
4
Gemfile
4
Gemfile
|
@ -3,6 +3,7 @@ source 'https://rubygems.org'
|
|||
gem 'yard'
|
||||
gem 'rgen'
|
||||
gem 'redcarpet'
|
||||
gem 'puppet-strings', '0.1.0', :path => '.'
|
||||
|
||||
if puppetversion = ENV['PUPPET_VERSION']
|
||||
gem 'puppet', puppetversion
|
||||
|
@ -15,6 +16,9 @@ group :test do
|
|||
gem 'mocha'
|
||||
gem 'puppetlabs_spec_helper'
|
||||
gem 'rspec-html-matchers'
|
||||
gem 'serverspec'
|
||||
gem 'beaker'
|
||||
gem 'beaker-rspec'
|
||||
end
|
||||
|
||||
group :development do
|
||||
|
|
6
Rakefile
6
Rakefile
|
@ -16,3 +16,9 @@ task :validate do
|
|||
sh "erb -P -x -T '-' #{template} | ruby -c"
|
||||
end
|
||||
end
|
||||
|
||||
task :acceptance do
|
||||
sh "puppet module build"
|
||||
sh "puppet module build spec/unit/puppet/examples/test"
|
||||
sh "BEAKER_set=#{ENV["platform"]} rspec spec/acceptance/*.rb"
|
||||
end
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
HOSTS:
|
||||
master:
|
||||
roles:
|
||||
- master
|
||||
platform: fedora-20-x86_64
|
||||
hypervisor: vcloud
|
||||
template: Delivery/Quality Assurance/Templates/vCloud/fedora-20-x86_64
|
||||
CONFIG:
|
||||
filecount: 12
|
||||
datastore: instance0
|
||||
resourcepool: delivery/Quality Assurance/FOSS/Dynamic
|
||||
folder: Delivery/Quality Assurance/FOSS/Dynamic
|
||||
pooling_api: http://vcloud.delivery.puppetlabs.net/
|
|
@ -0,0 +1,29 @@
|
|||
require 'spec_helper_acceptance'
|
||||
require 'rspec-html-matchers'
|
||||
require 'json'
|
||||
|
||||
describe 'Genearting module documation using yardoc action' do
|
||||
def read_file_on(host, filename)
|
||||
on(host, "cat #{filename}").stdout
|
||||
end
|
||||
|
||||
before :all do
|
||||
modules = JSON.parse(on(master, puppet("module", "list", "--render-as", "json")).stdout)
|
||||
test_module_info = modules["modules_by_path"].values.flatten.find { |mod_info| mod_info =~ /Module test/ }
|
||||
test_module_path = test_module_info.match(/\(([^)]*)\)/)[1]
|
||||
|
||||
on master, puppet("strings", "#{test_module_path}/**/*.{rb,pp}")
|
||||
end
|
||||
|
||||
it "should generate documentation for manifests" do
|
||||
expect(read_file_on(master, '/root/doc/test.html')).to have_tag('.docstring .discussion', :text => /This class/)
|
||||
end
|
||||
|
||||
it "should generate documenation for 3x functions" do
|
||||
expect(read_file_on(master, '/root/doc/Puppet3xFunctions.html')).to have_tag('.docstring .discussion', :text => /documentation for `function3x`/)
|
||||
end
|
||||
|
||||
it "should generate documenation for 4x functions" do
|
||||
expect(read_file_on(master, '/root/doc/Puppet4xFunctions.html')).to have_tag('.docstring .discussion', :text => /This is a function/)
|
||||
end
|
||||
end
|
|
@ -16,17 +16,17 @@ module StringsSpec
|
|||
# Registry is what we expect when testing handlers
|
||||
RSpec::Matchers.define :document_a do |arguments|
|
||||
match do |actual|
|
||||
compare_values(actual).empty?
|
||||
@mismatches = compare_values(actual, arguments)
|
||||
@mismatches.empty?
|
||||
end
|
||||
|
||||
failure_message do |actual|
|
||||
mismatches = compare_values(actual)
|
||||
mismatches.collect do |key, value|
|
||||
failure_message_for_should do
|
||||
@mismatches.collect do |key, value|
|
||||
"Expected #{key} to be <#{value[1]}>, but got <#{value[0]}>."
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
def compare_values(actual)
|
||||
def compare_values(actual, expected)
|
||||
mismatched_arguments = {}
|
||||
expected.each do |key, value|
|
||||
actual_value = actual.send(key)
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
require 'beaker-rspec/spec_helper'
|
||||
require 'beaker-rspec/helpers/serverspec'
|
||||
|
||||
unless ENV['RS_PROVISION'] == 'no'
|
||||
install_puppet
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
# Project root
|
||||
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
||||
|
||||
# Readable test descriptions
|
||||
c.formatter = :documentation
|
||||
|
||||
# Configure all nodes in nodeset
|
||||
c.before :suite do
|
||||
|
||||
hosts.each do |host|
|
||||
scp_to(host, Dir.glob('pkg/puppetlabs-strings*.gz').first, 'strings.tar.gz')
|
||||
on host, puppet('module', 'install', 'strings.tar.gz')
|
||||
|
||||
scp_to(host, Dir.glob('spec/unit/puppet/examples/test/pkg/username-test*.gz').first, 'test.tar.gz')
|
||||
on host, puppet('module', 'install', 'test.tar.gz')
|
||||
|
||||
on host, 'gem install yard'
|
||||
on host, 'gem install rgen'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,10 +0,0 @@
|
|||
name 'username-test'
|
||||
version '0.1.0'
|
||||
source ''
|
||||
author 'username'
|
||||
license 'Apache 2.0'
|
||||
summary ''
|
||||
description ''
|
||||
project_page ''
|
||||
|
||||
dependency 'puppetlabs/stdlib'
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"name": "username-test",
|
||||
"version": "0.0.1",
|
||||
"author": "username",
|
||||
"license": "Apache 2.0"
|
||||
}
|
|
@ -61,7 +61,7 @@ describe Puppet::Face do
|
|||
|
||||
Puppet::Face[:strings, :current].yardoc
|
||||
|
||||
expect(read_html(tmp, 'test', 'test.html')).to have_tag('.docstring .discussion', :text => /This class/)
|
||||
expect(read_html(tmp, 'test', 'Puppet4xFunctions.html')).to have_tag('.docstring .discussion', :text => /This is a function/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue