Skip to content

Instantly share code, notes, and snippets.

@ramarnat
Created June 3, 2015 16:25
Show Gist options
  • Select an option

  • Save ramarnat/4f5a0030fcf39246a056 to your computer and use it in GitHub Desktop.

Select an option

Save ramarnat/4f5a0030fcf39246a056 to your computer and use it in GitHub Desktop.
require 'spec_helper'
# module Full360
describe 'lib_epm::deploy' do
before do
allow_any_instance_of(Full360::Configurator).to receive(:stage_task_running?).and_return(false)
end
cached(:runner) {ChefSpec::SoloRunner.new(step_into: ['lib_epm_silent_xml_file', 'lib_epm_configurator'])}
cached(:chef_run) do
v = '11.1.2.4.0'
runner.node.namespace 'epm' do
version v
unzip_location '.'
namespace 'servers' do
namespace 'sql_server' do
host 'localhost'
port '1433'
sa_user 'sa'
server_sa_password 'password'
end
end
namespace 'stages' do
# Install
namespace 'install_01_foundation_web' do
type 'install'
depends_on []
end
# Config
# namespace 'config_01_foundation_web' do
# type 'config'
# depends_on ['install_01_foundation_web']
# reboot true
# end
end
end
runner.converge(described_recipe)
end
let(:epm_media_pack_defn) {::EPM::MediaPack.new(runner.node)}
cached(:node) {chef_run.node}
def include_epm_namespace
include(
"version"=> eql(epm_media_pack_defn.version),
"unzip_location"=>".",
"servers"=>
{"sql_server"=>
{"host"=>"localhost",
"port"=>"1433",
"sa_user"=>"sa",
"server_sa_password"=>"password"}
},
"stages"=>
{"install_01_foundation_web"=>{"type"=>"install", "depends_on"=>[]}},
"success_msg"=>"Invoked action: navigation.finish"
)
end
def include_foundation_install
include(
epm_media_pack_defn.platform =>
{ epm_media_pack_defn.version =>
{"install_01_foundation_web"=>
{"installer"=>
{"foundation"=>
{"enabled"=>true,
"staticContent"=>
{"enabled"=>true,
"product_component"=>"foundationServices",
"product"=>"foundation"},
"weblogic"=>
{"enabled"=>true,
"product_component"=>"foundationServices",
"product"=>"foundation"},
"hssWebApp"=>
{"enabled"=>true,
"product_component"=>"foundationServices",
"product"=>"foundation"}}},
"overrides"=>
{"HyperionHome"=>"HyperionHome",
"UserLocale"=>"UserLocale",
"ActionType"=>"ActionType",
"ProductHomes"=>"ProductHomes",
"UpgradeCleanUp"=>"UpgradeCleanUp",
"UninstallCleanUp"=>"UninstallCleanUp"},
"install_silent_xml_file"=> include("cookbooks/lib_epm/files/windows/#{epm_media_pack_defn.version}/install/install_01_foundation_web.xml"),
"global_properties"=>
{"HyperionHome"=>"C:\\Oracle\\Middleware",
"UserLocale"=>"",
"ActionType"=>"0",
"ProductHomes"=>"",
"UpgradeCleanUp"=>"",
"UninstallCleanUp"=>"false",
"jdbcUrl"=>{},
"adminHost"=>"Fauxhai",
"host"=>"Fauxhai"},
"depends_on"=>{},
"state"=>{}}}}
)
end
subject { chef_run }
context "loads the silent xml file" do
it { is_expected.to load_lib_epm_silent_xml_file("#{node['epm']['unzip_location']}/install_01_foundation_web.xml") }
it { is_expected.to create_template("./installTool-logging.xml") }
it { is_expected.to create_wintask_principal("#{node['hostname']}\\#{node['epm']['installer_user']}") }
it "generates the correct silent xml file" do
# pp node['epm']
sxml = chef_run.lib_epm_silent_xml_file("#{node['epm']['unzip_location']}/install_01_foundation_web.xml")
expect(sxml.action).to eql [:load, :generate]
expect(node['epm']).to include_epm_namespace
expect(node['epm'][EPM::PRODUCT]).to include_foundation_install
end
end
# expect(chef_run).to install_chef_gem('right_aws').at_compile_time
end
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment