spec_helper_acceptance.rb 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_rcu')
  39. puppet_module_install(:source => "#{project_root}/../fmw_inst", :module_name => 'fmw_inst')
  40. puppet_module_install(:source => "#{project_root}/../fmw_wls", :module_name => 'fmw_wls')
  41. puppet_module_install(:source => "#{project_root}/../fmw_jdk", :module_name => 'fmw_jdk')
  42. hosts.each do |host|
  43. on host, puppet('module', 'install', 'puppetlabs-stdlib', '--force', '--version', '3.2.0'), :acceptable_exit_codes => [0, 1]
  44. on host, puppet('module', 'install', 'puppetlabs-registry', '--force', '--version', '1.1.0'), :acceptable_exit_codes => [0, 1]
  45. if host['platform'] =~ /windows/
  46. endpoint = "http://127.0.0.1:5985/wsman"
  47. c.winrm = WinRM::WinRMWebService.new(endpoint, :ssl, :user => 'vagrant', :pass => 'vagrant', :basic_auth_only => true)
  48. c.winrm.set_timeout 300
  49. on(default, 'mkdir C:/software')
  50. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/jdk-7u75-linux-x64.tar.gz", 'C:/software')
  51. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/wls1036_generic.jar", 'C:/software')
  52. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/ofm_rcu_linux_11.1.1.7.0_64_disk1_1of1.zip", 'C:/software')
  53. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/fmw_12.1.3.0.0_infrastructure.jar", 'C:/software')
  54. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/fmw_12.1.3.0.0_soa_Disk1_1of1.zip", 'C:/software')
  55. else
  56. on(default, 'mkdir /software')
  57. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/jdk-7u75-linux-x64.tar.gz", '/software')
  58. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/wls1036_generic.jar", '/software')
  59. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/ofm_rcu_linux_11.1.1.7.0_64_disk1_1of1.zip", '/software')
  60. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/fmw_12.1.3.0.0_infrastructure.jar", '/software')
  61. scp_to(default, "#{ENV['SOFTWARE_FOLDER']}/fmw_12.1.3.0.0_soa_Disk1_1of1.zip", '/software')
  62. end
  63. end
  64. end
  65. end