Adding more spec coverage
This commit is contained in:
parent
176ff3abdc
commit
890ef5c471
42 changed files with 1751 additions and 11 deletions
25
spec/acceptance/delete_values_spec.rb
Normal file
25
spec/acceptance/delete_values_spec.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'delete_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'should delete elements of the hash' do
|
||||
pp = <<-EOS
|
||||
$a = { 'a' => 'A', 'b' => 'B', 'B' => 'C', 'd' => 'B' }
|
||||
$b = { 'a' => 'A', 'B' => 'C' }
|
||||
$o = delete_values($a, 'B')
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles non-hash arguments'
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
26
spec/acceptance/difference_spec.rb
Normal file
26
spec/acceptance/difference_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'difference function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'returns non-duplicates in the first array' do
|
||||
pp = <<-EOS
|
||||
$a = ['a','b','c']
|
||||
$b = ['b','c','d']
|
||||
$c = ['a']
|
||||
$o = difference($a, $b)
|
||||
if $o == $c {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles non-array arguments'
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
42
spec/acceptance/dirname_spec.rb
Normal file
42
spec/acceptance/dirname_spec.rb
Normal file
|
@ -0,0 +1,42 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'dirname function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
context 'absolute path' do
|
||||
it 'returns the dirname' do
|
||||
pp = <<-EOS
|
||||
$a = '/path/to/a/file.txt'
|
||||
$b = '/path/to/a'
|
||||
$o = dirname($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
context 'relative path' do
|
||||
it 'returns the dirname' do
|
||||
pp = <<-EOS
|
||||
$a = 'path/to/a/file.txt'
|
||||
$b = 'path/to/a'
|
||||
$o = dirname($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
39
spec/acceptance/downcase_spec.rb
Normal file
39
spec/acceptance/downcase_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'downcase function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'returns the downcase' do
|
||||
pp = <<-EOS
|
||||
$a = 'AOEU'
|
||||
$b = 'aoeu'
|
||||
$o = downcase($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'doesn\'t affect lowercase words' do
|
||||
pp = <<-EOS
|
||||
$a = 'aoeu aoeu'
|
||||
$b = 'aoeu aoeu'
|
||||
$o = downcase($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-strings'
|
||||
end
|
||||
end
|
39
spec/acceptance/empty_spec.rb
Normal file
39
spec/acceptance/empty_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'empty function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'recognizes empty strings' do
|
||||
pp = <<-EOS
|
||||
$a = ''
|
||||
$b = true
|
||||
$o = empty($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'recognizes non-empty strings' do
|
||||
pp = <<-EOS
|
||||
$a = 'aoeu'
|
||||
$b = false
|
||||
$o = empty($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-strings'
|
||||
end
|
||||
end
|
24
spec/acceptance/ensure_packages_spec.rb
Normal file
24
spec/acceptance/ensure_packages_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'ensure_packages function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'ensure_packages a package' do
|
||||
apply_manifest('package { "zsh": ensure => absent, }')
|
||||
pp = <<-EOS
|
||||
$a = "zsh"
|
||||
ensure_packages($a)
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :expect_changes => true) do |r|
|
||||
expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/)
|
||||
end
|
||||
end
|
||||
it 'ensures a package already declared'
|
||||
it 'takes defaults arguments'
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
it 'handles non strings'
|
||||
end
|
||||
end
|
24
spec/acceptance/ensure_resource_spec.rb
Executable file
24
spec/acceptance/ensure_resource_spec.rb
Executable file
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'ensure_resource function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'ensure_resource a package' do
|
||||
apply_manifest('package { "zsh": ensure => absent, }')
|
||||
pp = <<-EOS
|
||||
$a = "zsh"
|
||||
ensure_resource('package', $a)
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :expect_changes => true) do |r|
|
||||
expect(r.stdout).to match(/Package\[zsh\]\/ensure: created/)
|
||||
end
|
||||
end
|
||||
it 'ensures a resource already declared'
|
||||
it 'takes defaults arguments'
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
it 'handles non strings'
|
||||
end
|
||||
end
|
39
spec/acceptance/flatten_spec.rb
Normal file
39
spec/acceptance/flatten_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'flatten function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'flattens arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ["a","b",["c",["d","e"],"f","g"]]
|
||||
$b = ["a","b","c","d","e","f","g"]
|
||||
$o = flatten($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'does not affect flat arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ["a","b","c","d","e","f","g"]
|
||||
$b = ["a","b","c","d","e","f","g"]
|
||||
$o = flatten($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-strings'
|
||||
end
|
||||
end
|
39
spec/acceptance/floor_spec.rb
Normal file
39
spec/acceptance/floor_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'floor function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'floors floats' do
|
||||
pp = <<-EOS
|
||||
$a = 12.8
|
||||
$b = 12
|
||||
$o = floor($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'floors integers' do
|
||||
pp = <<-EOS
|
||||
$a = 7
|
||||
$b = 7
|
||||
$o = floor($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-numbers'
|
||||
end
|
||||
end
|
33
spec/acceptance/fqdn_rotate_spec.rb
Normal file
33
spec/acceptance/fqdn_rotate_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'fqdn_rotate function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
let(:facts_d) do
|
||||
if fact('is_pe') == "true"
|
||||
'/etc/puppetlabs/facter/facts.d'
|
||||
else
|
||||
'/etc/facter/facts.d'
|
||||
end
|
||||
end
|
||||
after :each do
|
||||
shell("if [ -f #{facts_d}/fqdn.txt ] ; then rm #{facts_d}/fqdn.txt ; fi")
|
||||
end
|
||||
it 'fqdn_rotates floats' do
|
||||
shell("echo 'fqdn=fakehost.localdomain' > #{facts_d}/fqdn.txt")
|
||||
pp = <<-EOS
|
||||
$a = ['a','b','c','d']
|
||||
$o = fqdn_rotate($a)
|
||||
notice(inline_template('fqdn_rotate is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/fqdn_rotate is \["c", "d", "a", "b"\]/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-numbers'
|
||||
end
|
||||
end
|
41
spec/acceptance/get_module_path_spec.rb
Normal file
41
spec/acceptance/get_module_path_spec.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'get_module_path function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'get_module_paths stdlib' do
|
||||
pp = <<-EOS
|
||||
$a = $::is_pe ? {
|
||||
'true' => '/opt/puppet/share/puppet/modules/stdlib',
|
||||
'false' => '/etc/puppet/modules/stdlib',
|
||||
}
|
||||
$o = get_module_path('stdlib')
|
||||
if $o == $a {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'get_module_paths dne' do
|
||||
pp = <<-EOS
|
||||
$a = $::is_pe ? {
|
||||
'true' => '/etc/puppetlabs/puppet/modules/dne',
|
||||
'false' => '/etc/puppet/modules/dne',
|
||||
}
|
||||
$o = get_module_path('dne')
|
||||
if $o == $a {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :expect_failures => true)
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-numbers'
|
||||
end
|
||||
end
|
25
spec/acceptance/getparam_spec.rb
Executable file
25
spec/acceptance/getparam_spec.rb
Executable file
|
@ -0,0 +1,25 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'getparam function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'getparam a package' do
|
||||
pp = <<-EOS
|
||||
user { "rspec":
|
||||
ensure => present,
|
||||
managehome => true,
|
||||
}
|
||||
$o = getparam(User['rspec'], 'managehome')
|
||||
notice(inline_template('getparam is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :expect_changes => true) do |r|
|
||||
expect(r.stdout).to match(/getparam is true/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
it 'handles non strings'
|
||||
end
|
||||
end
|
26
spec/acceptance/getvar_spec.rb
Normal file
26
spec/acceptance/getvar_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'getvar function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'getvars from classes' do
|
||||
pp = <<-EOS
|
||||
class a::data { $foo = 'aoeu' }
|
||||
include a::data
|
||||
$b = 'aoeu'
|
||||
$o = getvar("a::data::foo")
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-numbers'
|
||||
end
|
||||
end
|
26
spec/acceptance/grep_spec.rb
Normal file
26
spec/acceptance/grep_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'grep function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'greps arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaabbb','bbbccc','dddeee']
|
||||
$b = 'bbb'
|
||||
$c = ['aaabbb','bbbccc']
|
||||
$o = grep($a,$b)
|
||||
if $o == $c {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
44
spec/acceptance/has_interface_with_spec.rb
Normal file
44
spec/acceptance/has_interface_with_spec.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'has_interface_with function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'has_interface_with existing ipaddress' do
|
||||
pp = <<-EOS
|
||||
$a = '127.0.0.1'
|
||||
$o = has_interface_with('ipaddress', $a)
|
||||
notice(inline_template('has_interface_with is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/has_interface_with is true/)
|
||||
end
|
||||
end
|
||||
it 'has_interface_with absent ipaddress' do
|
||||
pp = <<-EOS
|
||||
$a = '128.0.0.1'
|
||||
$o = has_interface_with('ipaddress', $a)
|
||||
notice(inline_template('has_interface_with is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/has_interface_with is false/)
|
||||
end
|
||||
end
|
||||
it 'has_interface_with existing interface' do
|
||||
pp = <<-EOS
|
||||
$a = 'lo'
|
||||
$o = has_interface_with($a)
|
||||
notice(inline_template('has_interface_with is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/has_interface_with is true/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
it 'handles non strings'
|
||||
end
|
||||
end
|
33
spec/acceptance/has_ip_address_spec.rb
Executable file
33
spec/acceptance/has_ip_address_spec.rb
Executable file
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'has_ip_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'has_ip_address existing ipaddress' do
|
||||
pp = <<-EOS
|
||||
$a = '127.0.0.1'
|
||||
$o = has_ip_address($a)
|
||||
notice(inline_template('has_ip_address is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/has_ip_address is true/)
|
||||
end
|
||||
end
|
||||
it 'has_ip_address absent ipaddress' do
|
||||
pp = <<-EOS
|
||||
$a = '128.0.0.1'
|
||||
$o = has_ip_address($a)
|
||||
notice(inline_template('has_ip_address is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/has_ip_address is false/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
it 'handles non strings'
|
||||
end
|
||||
end
|
33
spec/acceptance/has_ip_network_spec.rb
Executable file
33
spec/acceptance/has_ip_network_spec.rb
Executable file
|
@ -0,0 +1,33 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'has_ip_network function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'has_ip_network existing ipaddress' do
|
||||
pp = <<-EOS
|
||||
$a = '127.0.0.0'
|
||||
$o = has_ip_network($a)
|
||||
notice(inline_template('has_ip_network is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/has_ip_network is true/)
|
||||
end
|
||||
end
|
||||
it 'has_ip_network absent ipaddress' do
|
||||
pp = <<-EOS
|
||||
$a = '128.0.0.0'
|
||||
$o = has_ip_network($a)
|
||||
notice(inline_template('has_ip_network is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/has_ip_network is false/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
it 'handles non strings'
|
||||
end
|
||||
end
|
41
spec/acceptance/has_key_spec.rb
Normal file
41
spec/acceptance/has_key_spec.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'has_key function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'has_keys in hashes' do
|
||||
pp = <<-EOS
|
||||
$a = { 'aaa' => 'bbb','bbb' => 'ccc','ddd' => 'eee' }
|
||||
$b = 'bbb'
|
||||
$c = true
|
||||
$o = has_key($a,$b)
|
||||
if $o == $c {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'has_keys not in hashes' do
|
||||
pp = <<-EOS
|
||||
$a = { 'aaa' => 'bbb','bbb' => 'ccc','ddd' => 'eee' }
|
||||
$b = 'ccc'
|
||||
$c = false
|
||||
$o = has_key($a,$b)
|
||||
if $o == $c {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-hashes'
|
||||
end
|
||||
end
|
26
spec/acceptance/hash_spec.rb
Normal file
26
spec/acceptance/hash_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'hashs arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa','bbb','bbb','ccc','ddd','eee']
|
||||
$b = { 'aaa' => 'bbb', 'bbb' => 'ccc', 'ddd' => 'eee' }
|
||||
$o = hash($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'handles odd-length arrays'
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
27
spec/acceptance/intersection_spec.rb
Normal file
27
spec/acceptance/intersection_spec.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'intersection function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'intersections arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa','bbb','ccc']
|
||||
$b = ['bbb','ccc','ddd','eee']
|
||||
$c = ['bbb','ccc']
|
||||
$o = intersection($a,$b)
|
||||
if $o == $c {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'intersections empty arrays'
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
67
spec/acceptance/is_array_spec.rb
Normal file
67
spec/acceptance/is_array_spec.rb
Normal file
|
@ -0,0 +1,67 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_array function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_arrays arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa','bbb','ccc']
|
||||
$b = true
|
||||
$o = is_array($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_arrays empty arrays' do
|
||||
pp = <<-EOS
|
||||
$a = []
|
||||
$b = true
|
||||
$o = is_array($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_arrays strings' do
|
||||
pp = <<-EOS
|
||||
$a = "aoeu"
|
||||
$b = false
|
||||
$o = is_array($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_arrays hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'bbb'}
|
||||
$b = false
|
||||
$o = is_array($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
81
spec/acceptance/is_bool_spec.rb
Normal file
81
spec/acceptance/is_bool_spec.rb
Normal file
|
@ -0,0 +1,81 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_bool function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_bools arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa','bbb','ccc']
|
||||
$b = false
|
||||
$o = is_bool($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_bools true' do
|
||||
pp = <<-EOS
|
||||
$a = true
|
||||
$b = true
|
||||
$o = is_bool($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_bools false' do
|
||||
pp = <<-EOS
|
||||
$a = false
|
||||
$b = true
|
||||
$o = is_bool($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_bools strings' do
|
||||
pp = <<-EOS
|
||||
$a = "true"
|
||||
$b = false
|
||||
$o = is_bool($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_bools hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'bbb'}
|
||||
$b = false
|
||||
$o = is_bool($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
83
spec/acceptance/is_domain_name_spec.rb
Normal file
83
spec/acceptance/is_domain_name_spec.rb
Normal file
|
@ -0,0 +1,83 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_domain_name function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_domain_names arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa.com','bbb','ccc']
|
||||
$o = is_domain_name($a)
|
||||
notice(inline_template('is_domain_name is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_domain_name is false/)
|
||||
end
|
||||
end
|
||||
it 'is_domain_names true' do
|
||||
pp = <<-EOS
|
||||
$a = true
|
||||
$o = is_domain_name($a)
|
||||
notice(inline_template('is_domain_name is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_domain_name is false/)
|
||||
end
|
||||
end
|
||||
it 'is_domain_names false' do
|
||||
pp = <<-EOS
|
||||
$a = false
|
||||
$o = is_domain_name($a)
|
||||
notice(inline_template('is_domain_name is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_domain_name is false/)
|
||||
end
|
||||
end
|
||||
it 'is_domain_names strings with hyphens' do
|
||||
pp = <<-EOS
|
||||
$a = "3foo-bar.2bar-fuzz.com"
|
||||
$b = true
|
||||
$o = is_domain_name($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_domain_names strings beginning with hyphens' do
|
||||
pp = <<-EOS
|
||||
$a = "-bar.2bar-fuzz.com"
|
||||
$b = false
|
||||
$o = is_domain_name($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_domain_names hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'www.com'}
|
||||
$o = is_domain_name($a)
|
||||
notice(inline_template('is_domain_name is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_domain_name is false/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
86
spec/acceptance/is_float_spec.rb
Normal file
86
spec/acceptance/is_float_spec.rb
Normal file
|
@ -0,0 +1,86 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_float function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_floats arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa.com','bbb','ccc']
|
||||
$o = is_float($a)
|
||||
notice(inline_template('is_floats is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_float is false/)
|
||||
end
|
||||
end
|
||||
it 'is_floats true' do
|
||||
pp = <<-EOS
|
||||
$a = true
|
||||
$o = is_float($a)
|
||||
notice(inline_template('is_floats is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_float is false/)
|
||||
end
|
||||
end
|
||||
it 'is_floats strings' do
|
||||
pp = <<-EOS
|
||||
$a = "3.5"
|
||||
$b = true
|
||||
$o = is_float($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_floats floats' do
|
||||
pp = <<-EOS
|
||||
$a = 3.5
|
||||
$b = true
|
||||
$o = is_float($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_floats integers' do
|
||||
pp = <<-EOS
|
||||
$a = 3
|
||||
$b = false
|
||||
$o = is_float($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_floats hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'www.com'}
|
||||
$o = is_float($a)
|
||||
notice(inline_template('is_float is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_floats is false/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
58
spec/acceptance/is_function_available_spec.rb
Normal file
58
spec/acceptance/is_function_available_spec.rb
Normal file
|
@ -0,0 +1,58 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_function_available function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_function_availables arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['fail','include','require']
|
||||
$o = is_function_available($a)
|
||||
notice(inline_template('is_function_available is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_function_available is false/)
|
||||
end
|
||||
end
|
||||
it 'is_function_availables true' do
|
||||
pp = <<-EOS
|
||||
$a = true
|
||||
$o = is_function_available($a)
|
||||
notice(inline_template('is_function_available is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_function_available is false/)
|
||||
end
|
||||
end
|
||||
it 'is_function_availables strings' do
|
||||
pp = <<-EOS
|
||||
$a = "fail"
|
||||
$b = true
|
||||
$o = is_function_available($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_function_availables function_availables' do
|
||||
pp = <<-EOS
|
||||
$a = "is_function_available"
|
||||
$o = is_function_available($a)
|
||||
notice(inline_template('is_function_available is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_function_available is true/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
63
spec/acceptance/is_hash_spec.rb
Normal file
63
spec/acceptance/is_hash_spec.rb
Normal file
|
@ -0,0 +1,63 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_hash function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_hashs arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa','bbb','ccc']
|
||||
$o = is_hash($a)
|
||||
notice(inline_template('is_hash is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_hash is false/)
|
||||
end
|
||||
end
|
||||
it 'is_hashs empty hashs' do
|
||||
pp = <<-EOS
|
||||
$a = {}
|
||||
$b = true
|
||||
$o = is_hash($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_hashs strings' do
|
||||
pp = <<-EOS
|
||||
$a = "aoeu"
|
||||
$b = false
|
||||
$o = is_hash($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_hashs hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'bbb'}
|
||||
$b = true
|
||||
$o = is_hash($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
95
spec/acceptance/is_integer_spec.rb
Normal file
95
spec/acceptance/is_integer_spec.rb
Normal file
|
@ -0,0 +1,95 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_integer function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_integers arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa.com','bbb','ccc']
|
||||
$b = false
|
||||
$o = is_integer($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_integers true' do
|
||||
pp = <<-EOS
|
||||
$a = true
|
||||
$b = false
|
||||
$o = is_integer($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_integers strings' do
|
||||
pp = <<-EOS
|
||||
$a = "3"
|
||||
$b = true
|
||||
$o = is_integer($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_integers floats' do
|
||||
pp = <<-EOS
|
||||
$a = 3.5
|
||||
$b = false
|
||||
$o = is_integer($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_integers integers' do
|
||||
pp = <<-EOS
|
||||
$a = 3
|
||||
$b = true
|
||||
$o = is_integer($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_integers hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'www.com'}
|
||||
$b = false
|
||||
$o = is_integer($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
80
spec/acceptance/is_ip_address_spec.rb
Normal file
80
spec/acceptance/is_ip_address_spec.rb
Normal file
|
@ -0,0 +1,80 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_ip_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_ip_addresss ipv4' do
|
||||
pp = <<-EOS
|
||||
$a = '1.2.3.4'
|
||||
$b = true
|
||||
$o = is_ip_address($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_ip_addresss ipv6' do
|
||||
pp = <<-EOS
|
||||
$a = "fe80:0000:cd12:d123:e2f8:47ff:fe09:dd74"
|
||||
$b = true
|
||||
$o = is_ip_address($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_ip_addresss ipv6 compressed' do
|
||||
pp = <<-EOS
|
||||
$a = "fe00::1"
|
||||
$b = true
|
||||
$o = is_ip_address($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_ip_addresss strings' do
|
||||
pp = <<-EOS
|
||||
$a = "aoeu"
|
||||
$b = false
|
||||
$o = is_ip_address($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_ip_addresss ipv4 out of range' do
|
||||
pp = <<-EOS
|
||||
$a = '1.2.3.400'
|
||||
$b = false
|
||||
$o = is_ip_address($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
38
spec/acceptance/is_mac_address_spec.rb
Normal file
38
spec/acceptance/is_mac_address_spec.rb
Normal file
|
@ -0,0 +1,38 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_mac_address function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_mac_addresss a mac' do
|
||||
pp = <<-EOS
|
||||
$a = '00:a0:1f:12:7f:a0'
|
||||
$b = true
|
||||
$o = is_mac_address($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_mac_addresss a mac out of range' do
|
||||
pp = <<-EOS
|
||||
$a = '00:a0:1f:12:7f:g0'
|
||||
$b = false
|
||||
$o = is_mac_address($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
95
spec/acceptance/is_numeric_spec.rb
Normal file
95
spec/acceptance/is_numeric_spec.rb
Normal file
|
@ -0,0 +1,95 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_numeric function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_numerics arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa.com','bbb','ccc']
|
||||
$b = false
|
||||
$o = is_numeric($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_numerics true' do
|
||||
pp = <<-EOS
|
||||
$a = true
|
||||
$b = false
|
||||
$o = is_numeric($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_numerics strings' do
|
||||
pp = <<-EOS
|
||||
$a = "3"
|
||||
$b = true
|
||||
$o = is_numeric($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_numerics floats' do
|
||||
pp = <<-EOS
|
||||
$a = 3.5
|
||||
$b = true
|
||||
$o = is_numeric($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_numerics integers' do
|
||||
pp = <<-EOS
|
||||
$a = 3
|
||||
$b = true
|
||||
$o = is_numeric($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_numerics hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'www.com'}
|
||||
$b = false
|
||||
$o = is_numeric($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
it 'handles non-arrays'
|
||||
end
|
||||
end
|
102
spec/acceptance/is_string_spec.rb
Normal file
102
spec/acceptance/is_string_spec.rb
Normal file
|
@ -0,0 +1,102 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'is_string function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'is_strings arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa.com','bbb','ccc']
|
||||
$b = false
|
||||
$o = is_string($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_strings true' do
|
||||
pp = <<-EOS
|
||||
$a = true
|
||||
$b = false
|
||||
$o = is_string($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_strings strings' do
|
||||
pp = <<-EOS
|
||||
$a = "aoeu"
|
||||
$o = is_string($a)
|
||||
notice(inline_template('is_string is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_string is true/)
|
||||
end
|
||||
end
|
||||
it 'is_strings number strings' do
|
||||
pp = <<-EOS
|
||||
$a = "3"
|
||||
$o = is_string($a)
|
||||
notice(inline_template('is_string is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/is_string is true/)
|
||||
end
|
||||
end
|
||||
it 'is_strings floats' do
|
||||
pp = <<-EOS
|
||||
$a = 3.5
|
||||
$b = false
|
||||
$o = is_string($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_strings integers' do
|
||||
pp = <<-EOS
|
||||
$a = 3
|
||||
$b = false
|
||||
$o = is_string($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'is_strings hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'www.com'}
|
||||
$b = false
|
||||
$o = is_string($a)
|
||||
if $o == $b {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
24
spec/acceptance/join_keys_to_values_spec.rb
Normal file
24
spec/acceptance/join_keys_to_values_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'join_keys_to_values function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'join_keys_to_valuess hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'bbb','ccc'=>'ddd'}
|
||||
$b = ':'
|
||||
$o = join_keys_to_values($a,$b)
|
||||
notice(inline_template('join_keys_to_values is <%= @o.sort.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/join_keys_to_values is \["aaa:bbb", "ccc:ddd"\]/)
|
||||
end
|
||||
end
|
||||
it 'handles non hashes'
|
||||
it 'handles empty hashes'
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
26
spec/acceptance/join_spec.rb
Normal file
26
spec/acceptance/join_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'join function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'joins arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa','bbb','ccc']
|
||||
$b = ':'
|
||||
$c = 'aaa:bbb:ccc'
|
||||
$o = join($a,$b)
|
||||
if $o == $c {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'handles non arrays'
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
23
spec/acceptance/keys_spec.rb
Normal file
23
spec/acceptance/keys_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'keys function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'keyss hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'aaa'=>'bbb','ccc'=>'ddd'}
|
||||
$o = keys($a)
|
||||
notice(inline_template('keys is <%= @o.sort.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/keys is \["aaa", "ccc"\]/)
|
||||
end
|
||||
end
|
||||
it 'handles non hashes'
|
||||
it 'handles empty hashes'
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
31
spec/acceptance/loadyaml_spec.rb
Normal file
31
spec/acceptance/loadyaml_spec.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'loadyaml function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'loadyamls array of values' do
|
||||
shell('echo "---
|
||||
aaa: 1
|
||||
bbb: 2
|
||||
ccc: 3
|
||||
ddd: 4" > /testyaml.yaml')
|
||||
pp = <<-EOS
|
||||
$o = loadyaml('/testyaml.yaml')
|
||||
notice(inline_template('loadyaml[aaa] is <%= @o["aaa"].inspect %>'))
|
||||
notice(inline_template('loadyaml[bbb] is <%= @o["bbb"].inspect %>'))
|
||||
notice(inline_template('loadyaml[ccc] is <%= @o["ccc"].inspect %>'))
|
||||
notice(inline_template('loadyaml[ddd] is <%= @o["ddd"].inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/loadyaml\[aaa\] is 1/)
|
||||
expect(r.stdout).to match(/loadyaml\[bbb\] is 2/)
|
||||
expect(r.stdout).to match(/loadyaml\[ccc\] is 3/)
|
||||
expect(r.stdout).to match(/loadyaml\[ddd\] is 4/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'fails with no arguments'
|
||||
end
|
||||
end
|
34
spec/acceptance/lstrip_spec.rb
Normal file
34
spec/acceptance/lstrip_spec.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'lstrip function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'lstrips arrays' do
|
||||
pp = <<-EOS
|
||||
$a = [" the "," public "," art","galleries "]
|
||||
# Anagram: Large picture halls, I bet
|
||||
$o = lstrip($a)
|
||||
notice(inline_template('lstrip is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/lstrip is \["the ", "public ", "art", "galleries "\]/)
|
||||
end
|
||||
end
|
||||
it 'lstrips strings' do
|
||||
pp = <<-EOS
|
||||
$a = " blowzy night-frumps vex'd jack q "
|
||||
$o = lstrip($a)
|
||||
notice(inline_template('lstrip is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/lstrip is "blowzy night-frumps vex'd jack q "/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
it 'handles non strings or arrays'
|
||||
end
|
||||
end
|
20
spec/acceptance/max_spec.rb
Normal file
20
spec/acceptance/max_spec.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'max function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'maxs arrays' do
|
||||
pp = <<-EOS
|
||||
$o = max("the","public","art","galleries")
|
||||
notice(inline_template('max is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/max is "the"/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
end
|
||||
end
|
26
spec/acceptance/member_spec.rb
Normal file
26
spec/acceptance/member_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'member function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'members arrays' do
|
||||
pp = <<-EOS
|
||||
$a = ['aaa','bbb','ccc']
|
||||
$b = 'ccc'
|
||||
$c = true
|
||||
$o = member($a,$b)
|
||||
if $o == $c {
|
||||
notify { 'output correct': }
|
||||
}
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/Notice: output correct/)
|
||||
end
|
||||
end
|
||||
it 'members arrays without members'
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles improper argument counts'
|
||||
end
|
||||
end
|
23
spec/acceptance/merge_spec.rb
Normal file
23
spec/acceptance/merge_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'merge function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'should merge two hashes' do
|
||||
pp = <<-EOS
|
||||
$a = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
|
||||
$b = {'two' => 'dos', 'three' => { 'five' => 5 } }
|
||||
$o = merge($a, $b)
|
||||
notice(inline_template('merge[one] is <%= @o["one"].inspect %>'))
|
||||
notice(inline_template('merge[two] is <%= @o["two"].inspect %>'))
|
||||
notice(inline_template('merge[three] is <%= @o["three"].inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/merge\[one\] is "1"/)
|
||||
expect(r.stdout).to match(/merge\[two\] is "dos"/)
|
||||
expect(r.stdout).to match(/merge\[three\] is {"five"=>"5"}/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
20
spec/acceptance/min_spec.rb
Normal file
20
spec/acceptance/min_spec.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
#! /usr/bin/env ruby -S rspec
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'min function', :unless => UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem')) do
|
||||
describe 'success' do
|
||||
it 'mins arrays' do
|
||||
pp = <<-EOS
|
||||
$o = min("the","public","art","galleries")
|
||||
notice(inline_template('min is <%= @o.inspect %>'))
|
||||
EOS
|
||||
|
||||
apply_manifest(pp, :catch_failures => true) do |r|
|
||||
expect(r.stdout).to match(/min is "art"/)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe 'failure' do
|
||||
it 'handles no arguments'
|
||||
end
|
||||
end
|
15
spec/acceptance/nodesets/centos-6-vcloud.yml
Normal file
15
spec/acceptance/nodesets/centos-6-vcloud.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
HOSTS:
|
||||
'centos-6-vcloud':
|
||||
roles:
|
||||
- master
|
||||
platform: el-6-x86_64
|
||||
hypervisor: vcloud
|
||||
template: centos-6-x86_64
|
||||
CONFIG:
|
||||
type: foss
|
||||
ssh:
|
||||
keys: "~/.ssh/id_rsa-acceptance"
|
||||
datastore: instance0
|
||||
folder: Delivery/Quality Assurance/Enterprise/Dynamic
|
||||
resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
|
||||
pooling_api: http://vcloud.delivery.puppetlabs.net/
|
|
@ -4,14 +4,16 @@ require 'beaker-rspec'
|
|||
UNSUPPORTED_PLATFORMS = []
|
||||
|
||||
unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
|
||||
if hosts.first.is_pe?
|
||||
install_pe
|
||||
on hosts, 'mkdir -p /etc/puppetlabs/facter/facts.d'
|
||||
else
|
||||
install_puppet
|
||||
on hosts, 'mkdir -p /etc/facter/facts.d'
|
||||
on hosts, '/bin/touch /etc/puppet/hiera.yaml'
|
||||
end
|
||||
hosts.each do |host|
|
||||
# Install Puppet
|
||||
if host.is_pe?
|
||||
install_pe
|
||||
else
|
||||
install_puppet
|
||||
on host, "mkdir -p #{host['distmoduledir']}"
|
||||
end
|
||||
on host, "mkdir -p #{host['distmoduledir']}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -24,10 +26,6 @@ RSpec.configure do |c|
|
|||
|
||||
# Configure all nodes in nodeset
|
||||
c.before :suite do
|
||||
# Install module and dependencies
|
||||
puppet_module_install(:source => proj_root, :module_name => 'stdlib')
|
||||
hosts.each do |host|
|
||||
shell('/bin/touch /etc/puppet/hiera.yaml')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue