spec_helper_acceptance.rb 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. require 'beaker-rspec/spec_helper'
  2. require 'beaker-rspec/helpers/serverspec'
  3. require 'winrm'
  4. UNSUPPORTED_PLATFORMS = [ 'Solaris', 'AIX' ]
  5. hosts.each do |host|
  6. if host['platform'] =~ /windows/
  7. include Serverspec::Helper::Windows
  8. include Serverspec::Helper::WinRM
  9. # This hack to install .net 3.5 exists because .net 3.5 has to be installed on 2012 and 2012 R2
  10. # in order for puppet to install
  11. #
  12. # @see PUP-1951
  13. # @see PUP-3965
  14. if host.to_s =~ /2012/
  15. DOTNET_HACK = <<-EOF.gsub!(/\n+/, '').gsub!(/^\s+/, '')
  16. $webclient = New-Object System.Net.WebClient ;
  17. $webclient.DownloadFile('https://googledrive.com/host/0B4_Bou5W3VsSfjRmeTBaak1Da2ZtVE95M25teWlfa0Y1NEVEYlBHNGV3S3liQTlWNTBGR0E/sxs.zip','C:\\Windows\\Temp\\sxs.zip') ;
  18. Add-Type -Assembly 'System.IO.Compression.FileSystem' ;
  19. [System.IO.Compression.ZipFile]::ExtractToDirectory('C:\\Windows\\Temp\\sxs.zip', 'C:\\Windows\\Temp\\sxs') ;
  20. Install-WindowsFeature Net-Framework-Core -source C:\\Windows\\Temp\\sxs ;
  21. shutdown /r /t 0
  22. EOF
  23. on host, powershell(DOTNET_HACK)
  24. sleep(30)
  25. host.close
  26. sleep(10)
  27. host.connection
  28. end
  29. version = ENV['PUPPET_VERSION'] || '3.7.5'
  30. install_puppet(:version => version)
  31. # Install an agent
  32. end
  33. end
  34. RSpec.configure do |c|
  35. project_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
  36. c.formatter = :documentation
  37. c.before :suite do
  38. puppet_module_install(:source => project_root, :module_name => 'fmw_bsu')
  39. puppet_module_install(:source => "#{project_root}/../fmw_wls", :module_name => 'fmw_wls')
  40. puppet_module_install(:source => "#{project_root}/../fmw_jdk", :module_name => 'fmw_jdk')
  41. hosts.each do |host|
  42. on host, puppet('module', 'install', 'puppetlabs-stdlib', '--force', '--version', '3.2.0'), :acceptable_exit_codes => [0, 1]
  43. on host, puppet('module', 'install', 'puppetlabs-registry', '--force', '--version', '1.1.0'), :acceptable_exit_codes => [0, 1]
  44. if host['platform'] =~ /windows/
  45. endpoint = "http://127.0.0.1:5985/wsman"
  46. c.winrm = WinRM::WinRMWebService.new(endpoint, :ssl, :user => 'vagrant', :pass => 'vagrant', :basic_auth_only => true)
  47. c.winrm.set_timeout 300
  48. on(default, 'mkdir C:/software')
  49. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/jdk-7u75-linux-x64.tar.gz", 'C:/software')
  50. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/wls1036_generic.jar", 'C:/software')
  51. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/p20181997_1036_Generic.zip", 'C:/software')
  52. else
  53. on(default, 'mkdir /software')
  54. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/jdk-7u75-linux-x64.tar.gz", '/software')
  55. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/wls1036_generic.jar", '/software')
  56. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/p20181997_1036_Generic.zip", '/software')
  57. end
  58. end
  59. end
  60. end