source: other-projects/hathitrust/vagrant-hadoop-cluster/trunk/modules/stdlib/spec/acceptance/has_interface_with_spec.rb@ 30903

Last change on this file since 30903 was 30903, checked in by davidb, 8 years ago

Vagrant provisioning files for a 4-node Hadoop cluster. See README.txt for more details

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#! /usr/bin/env ruby -S rspec
2require 'spec_helper_acceptance'
3
4describe 'has_interface_with function', :unless => ((UNSUPPORTED_PLATFORMS.include?(fact('operatingsystem'))) or (fact('osfamily') == 'windows') or (fact('osfamily') == 'AIX')) do
5 describe 'success' do
6 it 'has_interface_with existing ipaddress' do
7 pp = <<-EOS
8 $a = $::ipaddress
9 $o = has_interface_with('ipaddress', $a)
10 notice(inline_template('has_interface_with is <%= @o.inspect %>'))
11 EOS
12
13 apply_manifest(pp, :catch_failures => true) do |r|
14 expect(r.stdout).to match(/has_interface_with is true/)
15 end
16 end
17 it 'has_interface_with absent ipaddress' do
18 pp = <<-EOS
19 $a = '128.0.0.1'
20 $o = has_interface_with('ipaddress', $a)
21 notice(inline_template('has_interface_with is <%= @o.inspect %>'))
22 EOS
23
24 apply_manifest(pp, :catch_failures => true) do |r|
25 expect(r.stdout).to match(/has_interface_with is false/)
26 end
27 end
28 it 'has_interface_with existing interface' do
29 pp = <<-EOS
30 if $osfamily == 'Solaris' or $osfamily == 'Darwin' {
31 $a = 'lo0'
32 }elsif $osfamily == 'windows' {
33 $a = $::kernelmajversion ? {
34 /6\.(2|3|4)/ => 'Ethernet0',
35 /6\.(0|1)/ => 'Local_Area_Connection',
36 /5\.(1|2)/ => undef, #Broken current in facter
37 }
38 }else {
39 $a = 'lo'
40 }
41 $o = has_interface_with($a)
42 notice(inline_template('has_interface_with is <%= @o.inspect %>'))
43 EOS
44
45 apply_manifest(pp, :catch_failures => true) do |r|
46 expect(r.stdout).to match(/has_interface_with is true/)
47 end
48 end
49 end
50 describe 'failure' do
51 it 'handles no arguments'
52 it 'handles non strings'
53 end
54end
Note: See TracBrowser for help on using the repository browser.