install_spec.rb 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. require 'spec_helper'
  2. describe 'fmw_wls::install', :type => :class do
  3. describe 'unix' do
  4. let :pre_condition do
  5. 'class { "fmw_jdk::install":
  6. java_home_dir => "/usr/java/jdk1.8.0_XX",
  7. source_file => "/software/jdk-8u40-linux-x64.tar.gz",
  8. }'
  9. end
  10. describe 'When all attributes are default, on an unspecified platform' do
  11. it do
  12. expect { should contain_package('xxx')
  13. }.to raise_error(Puppet::Error, /Not supported Operation System, please use it on windows, linux or solaris host/)
  14. end
  15. end
  16. describe 'With attributes, on an unspecified platform' do
  17. let(:params){{
  18. :java_home_dir => '/usr/java/jdk1.8.0_XX',
  19. :source_file => '/software/fmw_12.1.3.0.0_wls.jar',
  20. }}
  21. it do
  22. expect { should contain_package('xxx')
  23. }.to raise_error(Puppet::Error, /Not supported Operation System, please use it on windows, linux or solaris host/)
  24. end
  25. end
  26. describe 'With default attributes, on CentOS platform' do
  27. let(:facts) {{ operatingsystem: 'CentOS',
  28. kernel: 'Linux',
  29. osfamily: 'RedHat',
  30. operatingsystemmajrelease: '6' }}
  31. it do
  32. expect { should contain_package('xxx')
  33. }.to raise_error(Puppet::Error, /java_home_dir parameter cannot be empty/)
  34. end
  35. end
  36. describe 'With java_home_dir attribute, on CentOS platform' do
  37. let(:facts) {{ operatingsystem: 'CentOS',
  38. kernel: 'Linux',
  39. osfamily: 'RedHat',
  40. operatingsystemmajrelease: '6' }}
  41. let(:params){{
  42. :java_home_dir => '/usr/java/jdk1.8.0_XX'
  43. }}
  44. it do
  45. expect { should contain_package('xxx')
  46. }.to raise_error(Puppet::Error, /source_file parameter cannot be empty/)
  47. end
  48. end
  49. describe 'With attributes 12.1.3, on CentOS platform' do
  50. let(:facts) {{ operatingsystem: 'CentOS',
  51. kernel: 'Linux',
  52. osfamily: 'RedHat',
  53. operatingsystemmajrelease: '6' }}
  54. let(:params){{
  55. :java_home_dir => '/usr/java/jdk1.8.0_XX',
  56. :source_file => '/software/fmw_12.1.3.0.0_wls.jar',
  57. }}
  58. it { should contain_class('fmw_wls::internal::wls_linux').with(
  59. java_home_dir: '/usr/java/jdk1.8.0_XX',
  60. source_file: '/software/fmw_12.1.3.0.0_wls.jar',
  61. install_type: 'wls',
  62. )
  63. }
  64. end
  65. describe 'With attributes 12.1.3 infra, on CentOS platform' do
  66. let(:facts) {{ operatingsystem: 'CentOS',
  67. kernel: 'Linux',
  68. osfamily: 'RedHat',
  69. operatingsystemmajrelease: '7' }}
  70. let(:params){{
  71. :java_home_dir => '/usr/java/jdk1.7.0_XX',
  72. :source_file => '/software/fmw_12.1.3.0.0_infrastructure.jar',
  73. :install_type => 'infra',
  74. }}
  75. it { should contain_class('fmw_wls::internal::wls_linux').with(
  76. java_home_dir: '/usr/java/jdk1.7.0_XX',
  77. source_file: '/software/fmw_12.1.3.0.0_infrastructure.jar',
  78. install_type: 'infra',
  79. )
  80. }
  81. end
  82. describe 'With attributes 12.1.3, on a Solaris platform' do
  83. let(:facts) {{ operatingsystem: 'Solaris',
  84. kernel: 'SunOS',
  85. osfamily: 'SunOS',
  86. operatingsystemmajrelease: '5.11' }}
  87. let(:params){{
  88. :java_home_dir => '/usr/java/jdk1.8.0_XX',
  89. :source_file => '/software/fmw_12.1.3.0.0_wls.jar',
  90. }}
  91. it { should contain_class('fmw_wls::internal::wls_solaris').with(
  92. java_home_dir: '/usr/java/jdk1.8.0_XX',
  93. source_file: '/software/fmw_12.1.3.0.0_wls.jar',
  94. install_type: 'wls',
  95. )
  96. }
  97. end
  98. end
  99. describe 'With attributes 12.1.3, on Windows platform' do
  100. let :pre_condition do
  101. 'class { "fmw_jdk::install":
  102. java_home_dir => "C:/java/jdk1.7.0_XX",
  103. source_file => "C://software/jdk-8u40-linux-x64.exe",
  104. }'
  105. end
  106. let(:facts) {{ operatingsystem: 'windows',
  107. kernel: 'windows',
  108. osfamily: 'windows'}}
  109. let(:params){{
  110. :java_home_dir => 'C:/java/jdk1.7.0_XX',
  111. :source_file => 'C:/software/fmw_12.1.3.0.0_wls.jar',
  112. }}
  113. it { should contain_class('fmw_wls::internal::wls_windows').with(
  114. java_home_dir: 'C:/java/jdk1.7.0_XX',
  115. source_file: 'C:/software/fmw_12.1.3.0.0_wls.jar',
  116. install_type: 'wls',
  117. )
  118. }
  119. end
  120. end