Skip to content

Instantly share code, notes, and snippets.

@samjsharpe
Created September 30, 2014 10:15
Show Gist options
  • Save samjsharpe/7e37e4b10b4a4de3f1ee to your computer and use it in GitHub Desktop.
Save samjsharpe/7e37e4b10b4a4de3f1ee to your computer and use it in GitHub Desktop.
context "running launch commands" do
before(:all) do
@test_data = define_test_data
@config_yaml = ErbHelper.convert_erb_template_to_yaml(@test_data, File.join(File.dirname(__FILE__), 'data/happy_path.yaml.erb'))
@api_interface = Vcloud::Core::ApiInterface.new
end
context "which exit with success" do
Vcloud::Launcher::Launch.new(@config_yaml, { "continue-on-error" => false, "post-launch-cmd" => 'data/true_cmd'}).run
@vapp_query_result = @api_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name], @test_data[:vdc_name])
@vapp_id = @vapp_query_result[:href].split('/').last
it 'should log success' do
#TODO
end
end
context "which exit with failure" do
Vcloud::Launcher::Launch.new(@config_yaml, { "continue-on-error" => false, "post-launch-cmd" => 'data/false_cmd'}).run
@vapp_query_result = @api_interface.get_vapp_by_name_and_vdc_name(@test_data[:vapp_name], @test_data[:vdc_name])
@vapp_id = @vapp_query_result[:href].split('/').last
it 'should log an error' do
#TODO
end
end
after(:all) do
unless ENV['VCLOUD_TOOLS_RSPEC_NO_DELETE_VAPP']
File.delete @config_yaml
expect(@api_interface.delete_vapp(@vapp_id)).to eq(true)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment