diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..c588f19848a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +script: "./ci_build.rb" +rvm: + - 1.9.2 +env: + - SUITE=unit + - SUITE=integration \ No newline at end of file diff --git a/agent/spec/functional/agent_controller_spec.rb b/agent/spec/functional/agent_controller_spec.rb index a82c38f2df6..25c3adc2a0e 100644 --- a/agent/spec/functional/agent_controller_spec.rb +++ b/agent/spec/functional/agent_controller_spec.rb @@ -19,10 +19,8 @@ def self.long_running?; true; end describe Bosh::Agent::AgentController do include Rack::Test::Methods - def app - handler = Bosh::Agent::HTTPHandler.new - Bosh::Agent::AgentController.new(handler) - end + let(:handler) { Bosh::Agent::HTTPHandler.new } + let(:app) { Bosh::Agent::AgentController.new(handler) } def agent_call(method, args=[]) post "/agent", {}, { @@ -79,6 +77,8 @@ def agent_response end it "should throw exception with invalid apply_spec" do + handler.should_receive(:kill_main_thread_in) + message = Bosh::Agent::Message::ReleaseApplySpec message.any_instance.stub(:release_apply_spec).and_return("") diff --git a/aws_cpi/Gemfile b/aws_cpi/Gemfile index 38c5eb31665..96fc08262e8 100644 --- a/aws_cpi/Gemfile +++ b/aws_cpi/Gemfile @@ -11,7 +11,7 @@ group :development do gem "guard-rspec" gem "guard-yard" gem "redcarpet" - gem "ruby_gntp" + gem "terminal-notifier-guard" gem "rb-fsevent" gem "ruby-debug", :platforms => :ruby_18 diff --git a/aws_cpi/Gemfile.lock b/aws_cpi/Gemfile.lock index 467fb568cf0..45e0e043738 100644 --- a/aws_cpi/Gemfile.lock +++ b/aws_cpi/Gemfile.lock @@ -88,7 +88,6 @@ GEM ruby-debug-base19 (>= 0.11.19) ruby_core_source (0.1.5) archive-tar-minitar (>= 0.5.2) - ruby_gntp (0.3.4) simplecov (0.6.1) multi_json (~> 1.0) simplecov-html (~> 0.5.3) @@ -96,6 +95,7 @@ GEM simplecov-rcov (0.2.3) simplecov (>= 0.4.1) slop (3.3.3) + terminal-notifier-guard (1.5.3) thor (0.16.0) uuidtools (2.1.3) yajl-ruby (1.1.0) @@ -118,6 +118,6 @@ DEPENDENCIES rspec (~> 2.10) ruby-debug ruby-debug19 - ruby_gntp simplecov simplecov-rcov + terminal-notifier-guard diff --git a/aws_cpi/lib/cloud/aws/cloud.rb b/aws_cpi/lib/cloud/aws/cloud.rb index e11eec8f894..e0b5e319224 100644 --- a/aws_cpi/lib/cloud/aws/cloud.rb +++ b/aws_cpi/lib/cloud/aws/cloud.rb @@ -400,10 +400,11 @@ def set_vm_metadata(vm, metadata) tag(instance, key, value) end - # should deployment name be included too? - job = metadata[:job] - index = metadata[:index] - tag(instance, "Name", "#{job}/#{index}") if job && index + if metadata.has_key?(:compiling) + tag(instance, "Name", "compilation") + elsif metadata.has_key?(:job) && metadata.has_key?(:index) + tag(instance, "Name", "#{metadata[:job]}/#{metadata[:index]}") + end rescue AWS::EC2::Errors::TagLimitExceeded => e @logger.error("could not tag #{instance.id}: #{e.message}") end @@ -444,7 +445,8 @@ def ensure_same_availability_zone(disks, default) private - # add a tag to something + # Add a tag to something, make sure that the tag conforms to the + # AWS limitation of 127 character key and 255 character value def tag(taggable, key, value) trimmed_key = key[0..(MAX_TAG_KEY_LENGTH - 1)] trimmed_value = value[0..(MAX_TAG_VALUE_LENGTH - 1)] diff --git a/aws_cpi/spec/unit/set_vm_metadata_spec.rb b/aws_cpi/spec/unit/set_vm_metadata_spec.rb index abb9fdbe9a4..608ad8b9e0b 100644 --- a/aws_cpi/spec/unit/set_vm_metadata_spec.rb +++ b/aws_cpi/spec/unit/set_vm_metadata_spec.rb @@ -13,9 +13,11 @@ it "should add new tags" do metadata = {:job => "job", :index => "index"} + @cloud.should_receive(:tag).with(@instance, :job, "job") @cloud.should_receive(:tag).with(@instance, :index, "index") @cloud.should_receive(:tag).with(@instance, "Name", "job/index") + @cloud.set_vm_metadata("i-foobar", metadata) end @@ -27,4 +29,11 @@ end @cloud.set_vm_metadata("i-foobar", metadata) end + + it "should set 'Name' tag for compilation instances" do + @cloud.should_receive(:tag).with(@instance, :compiling, "package") + @cloud.should_receive(:tag).with(@instance, "Name", "compilation") + + @cloud.set_vm_metadata("i-foobar", {:compiling => "package"}) + end end diff --git a/blobstore_client/spec/functional/s3_spec.rb b/blobstore_client/spec/functional/s3_spec.rb index 075f6f159f9..6b030ec6da5 100644 --- a/blobstore_client/spec/functional/s3_spec.rb +++ b/blobstore_client/spec/functional/s3_spec.rb @@ -23,7 +23,8 @@ def secret_access_key @s3.delete(@oid2) if @oid2 end - before(:all) do + before do + pending "EC2_ACCESS_KEY required to run S3 specs" unless ENV['EC2_ACCESS_KEY'] s3_options = { :bucket_name => "bosh-blobstore-bucket", :access_key_id => access_key_id, @@ -95,7 +96,8 @@ def secret_access_key end context "encrypted", :focus => true do - before(:all) do + before do + pending "EC2_ACCESS_KEY required to run S3 specs" unless ENV['EC2_ACCESS_KEY'] s3_options = { :bucket_name => "bosh-blobstore-bucket", :access_key_id => access_key_id, diff --git a/ci_build.rb b/ci_build.rb new file mode 100755 index 00000000000..f25eb9bec7f --- /dev/null +++ b/ci_build.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby + +def bundle_without + ENV['HAS_JOSH_K_SEAL_OF_APPROVAL'] ? "--without development" : "" +end + +def run_bundler_in(dir) + system("cd #{dir} && (bundle check || bundle install #{bundle_without})") || raise("Bundle Failed") +end + +if ENV['SUITE'] == "integration" + %w{spec cli director health_monitor simple_blobstore_server agent}.each do |dir| + run_bundler_in(dir) + end + + exec("cd spec && bundle exec rake spec") +else + builds = Dir['*'].select {|f| File.directory?(f) && File.exists?("#{f}/spec")} + builds.delete('bat') + builds.delete('aws_bootstrap') + + redis_pid = fork { exec("redis-server --port 63790") } + at_exit { Process.kill("KILL", redis_pid) } + + builds.each do |build| + p "-----#{build}-----" + run_bundler_in(build) + system("cd #{build} && bundle exec rspec spec") || raise("FAILED -- #{build}") + end +end \ No newline at end of file diff --git a/cpi/vendor/cache/bosh_common-0.5.0.gem b/cpi/vendor/cache/bosh_common-0.5.0.gem deleted file mode 100644 index a1a3dc9c366..00000000000 Binary files a/cpi/vendor/cache/bosh_common-0.5.0.gem and /dev/null differ diff --git a/cpi/vendor/cache/bosh_common-0.5.2.gem b/cpi/vendor/cache/bosh_common-0.5.2.gem new file mode 100644 index 00000000000..d7ccd50e8c0 Binary files /dev/null and b/cpi/vendor/cache/bosh_common-0.5.2.gem differ diff --git a/director/spec/cpi/cpi_test_spec.rb b/director/spec/cpi/cpi_test_spec.rb deleted file mode 100644 index ebd247ffce0..00000000000 --- a/director/spec/cpi/cpi_test_spec.rb +++ /dev/null @@ -1,247 +0,0 @@ -# Copyright (c) 2009-2012 VMware, Inc. - -require File.expand_path("../../spec_helper", __FILE__) -require File.expand_path("../sandbox", __FILE__) -require 'pty' -require 'expect' -require 'rack/test' -require "ruby_vim_sdk" -require "cloud/vsphere" - -describe Bosh::Clouds do - include Rack::Test::Methods - include Bosh::Director::IpUtil - include VimSdk - - AGENT_SRC_PATH = File.expand_path("../../../../agent", __FILE__) - - def get_ip - avail_ip = @available_test_ip.first - @available_test_ip.delete(avail_ip) - ip_to_netaddr(avail_ip).ip - end - - def vm_reachable?(ip, timeout = 300) - `ping -q -c 1 -w #{timeout} #{ip}` - return $?.exitstatus == 0 - end - - def build_stemcell(pass) - iso_mnt = "" - stemcell_tgz = "" - Dir.chdir(AGENT_SRC_PATH) do - stemcell_tgz = "" - PTY.spawn("rake ubuntu:stemcell:build") do |reader, writer, pid| - if pass - reader.expect(/.*password.*:.*/) do - writer.puts(pass) - end - end - reader.expect(/.*\['mount', '-o', 'loop', '-t', 'iso.*', '.*', '.*/) do - iso_mnt = reader.gets.split('\'')[0] - end - - reader.expect(/Generated stemcell:.*/) do - stemcell_tgz = reader.gets.strip - end - end - - end - - # un-mount ubuntu.iso used by vmbuilder. - PTY.spawn("sudo umount -d #{iso_mnt}") do |reader, writer, pid| - if pass - reader.expect(/.*password.*:.*/) - writer.puts(pass) - end - end - stemcell_tgz - end - - def check_vm_tools(vm_cid) - vm = @vsphere_client.find_by_inventory_path([@datacenter.name, "vm", @datacenter.vm_folder_name, vm_cid]) - return false if vm.nil? - vm_tools_status = @vsphere_client.get_property(vm, Vim::VirtualMachine, "guest.toolsRunningStatus") - vm_tools_status == Vim::Vm::GuestInfo::ToolsRunningStatus::GUEST_TOOLS_RUNNING - end - - # vmbuilder generates bogus stemcells once in a while. - # deploy a dummy VM to verify the stemcell. - def stemcell_check - result = false - agent_id = UUIDTools::UUID.random_create.to_s - vm_ip = get_ip - net_config = {'test' => {'cloud_properties' => @net_conf['cloud_properties'], - 'netmask' => @net_conf['netmask'], - 'gateway' => @net_conf['gateway'], - 'ip' => vm_ip, - 'dns' => @net_conf['dns'], - 'default' => ['dns', 'gateway']}} - begin - vm_cid = @cloud.create_vm(agent_id, @stemcell_name, @vm_resource, net_config) - 2.times do - result = check_vm_tools(vm_cid) || vm_reachable?(vm_ip) - break if result - end - ensure - @cloud.delete_vm(vm_cid) if vm_cid - end - result - end - - before(:all) do - @test_config = Bosh::Director::Cpi::Sandbox.start - @net_conf = @test_config['network'] - - @available_test_ip = Set.new - each_ip(@net_conf['range']) do |ip| - @available_test_ip.add(ip) - end - @vm_resource = {"ram" => 1024, "disk" => 256, "cpu" => 1} - - Thread.new { EM.run{} } - while !EM.reactor_running? - sleep 0.1 - end - - Bosh::Director::Config.configure(@test_config) - SpecHelper.init_database - cloud_properties = @test_config["cloud"]["properties"] - @cloud = Bosh::Clouds::Provider.create("vsphere", cloud_properties) - - vcenter = cloud_properties["vcenters"][0] - @vsphere_client = VSphereCloud::Client.new("https://#{vcenter["host"]}/sdk/vimService", cloud_properties) - @vsphere_client.login(vcenter["user"], vcenter["password"], "en") - resources = VSphereCloud::Resources.new(@vsphere_client, vcenter, 1.0) - @datacenter = resources.datacenters.values.first - - valid_stemcell = false - # try up to 3 times - 3.times do - stemcell_tgz = @test_config["stemcell"] - stemcell_tgz ||= build_stemcell(@test_config["root_pass"]) - - # un-tar stemcell - stemcell = Dir.mktmpdir("tmp_sc") - `tar zxf #{stemcell_tgz} -C #{stemcell}` - if $?.exitstatus != 0 - FileUtils.rm_rf(stemcell) - raise "Failed to un-tar #{stemcell_tgz}" - end - - @stemcell_name = @cloud.create_stemcell("#{stemcell}/image", {}) - FileUtils.rm_rf(stemcell) - - # verify stemcell - valid_stemcell = stemcell_check - break if valid_stemcell - @cloud.delete_stemcell(@stemcell_name) - break if @test_config["stemcell"] - end - - unless valid_stemcell - if @test_config["stemcell"] - raise "Invalid stemcell #{@test_config["stemcell"]}" - else - raise "Failed to create a valid stemcell" - end - end - end - - before(:each) do - Bosh::Director::Config.configure(@test_config) - @cloud = Bosh::Clouds::VSphere.new(@test_config["cloud"]["properties"]) - end - - after(:all) do - @cloud = Bosh::Clouds::VSphere.new(@test_config["cloud"]["properties"]) - @cloud.delete_stemcell(@stemcell_name) - Bosh::Director::Cpi::Sandbox.stop - end - - it "create/delete a VM" do - agent_id = UUIDTools::UUID.random_create.to_s - vm_ip = get_ip - net_config = {'test' => {'cloud_properties' => @net_conf['cloud_properties'], - 'netmask' => @net_conf['netmask'], - 'gateway' => @net_conf['gateway'], - 'ip' => vm_ip, - 'dns' => @net_conf['dns'], - 'default' => ['dns', 'gateway']}} - begin - vm_cid = @cloud.create_vm(agent_id, @stemcell_name, @vm_resource, net_config) - vm_reachable?(vm_ip).should == true - ensure - @cloud.delete_vm(vm_cid) if vm_cid - end - end - - it "reconfigure vm ip address" do - agent_id = UUIDTools::UUID.random_create.to_s - vm_ip_a = get_ip - vm_ip_b = get_ip - net_config = {'test' => {'cloud_properties' => @net_conf['cloud_properties'], - 'netmask' => @net_conf['netmask'], - 'gateway' => @net_conf['gateway'], - 'ip' => vm_ip_a, - 'dns' => @net_conf['dns'], - 'default' => ['dns', 'gateway']}} - begin - vm_cid = @cloud.create_vm(agent_id, @stemcell_name, @vm_resource, net_config) - - # test network - vm_reachable?(vm_ip_b, 10).should == false - vm_reachable?(vm_ip_a).should == true - - pid = Bosh::Director::Cpi::Sandbox.start_nats_tunnel(vm_ip_a) - agent = Bosh::Director::AgentClient.new(agent_id) - agent.get_state - - # change the ip - net_config['test']['ip'] = vm_ip_b - agent.prepare_network_change(net_config) - @cloud.configure_networks(vm_cid, net_config) - - # test network - vm_reachable?(vm_ip_b).should == true - vm_reachable?(vm_ip_a, 10).should == false - ensure - Bosh::Director::Cpi::Sandbox.stop_nats_tunnel(pid) rescue nil - @cloud.delete_vm(vm_cid) if vm_cid - end - end - - it "disk operations create/delete attach/detach and move disk" do - disk_cid = nil - 2.times do - agent_id = UUIDTools::UUID.random_create.to_s - vm_ip = get_ip - net_config = {'test' => {'cloud_properties' => @net_conf['cloud_properties'], - 'netmask' => @net_conf['netmask'], - 'gateway' => @net_conf['gateway'], - 'ip' => vm_ip, - 'dns' => @net_conf['dns'], - 'default' => ['dns', 'gateway']}} - begin - vm_cid = @cloud.create_vm(agent_id, @stemcell_name, @vm_resource, net_config) - - vm_reachable?(vm_ip).should == true - - pid = Bosh::Director::Cpi::Sandbox.start_nats_tunnel(vm_ip) - agent = Bosh::Director::AgentClient.new(agent_id) - agent.get_state - - disk_cid = @cloud.create_disk(256, vm_cid) unless disk_cid - @cloud.attach_disk(vm_cid, disk_cid) - - agent.mount_disk(disk_cid) - agent.unmount_disk(disk_cid) - ensure - Bosh::Director::Cpi::Sandbox.stop_nats_tunnel(pid) rescue nil - @cloud.detach_disk(vm_cid, disk_cid) rescue nil - @cloud.delete_vm(vm_cid) rescue nil - end - end - @cloud.delete_disk(disk_cid) rescue nil - end -end diff --git a/director/spec/cpi/sandbox.rb b/director/spec/cpi/sandbox.rb deleted file mode 100644 index b4f4366c401..00000000000 --- a/director/spec/cpi/sandbox.rb +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (c) 2009-2012 VMware, Inc. - -module Bosh::Director::Cpi - class Sandbox - NATS_PID = File.join("/tmp", "cpi-nats.pid") - NATS_PORT = 4222 - - class << self - def start - run_with_pid("nats-server -p #{NATS_PORT}", NATS_PID) - test_config = YAML.load(spec_asset("test-cpi-config.yml")) - test_config["cloud"]["properties"]["mbus"] = "nats://localhost:#{NATS_PORT}" - test_config["mbus"] = "nats://localhost:#{NATS_PORT}" - test_config - end - - def stop - kill_process(NATS_PID) - end - - def start_nats_tunnel(vm_ip) - pid_file = File.join("/tmp", "cpi-nats-tunnel-#{rand(1000)}.pid") - cmd = "sshpass -p 'c1oudc0w' ssh -R #{NATS_PORT}:localhost:#{NATS_PORT} -o \"UserKnownHostsFile /dev/null\" -o StrictHostKeyChecking=no -N root@#{vm_ip}" - run_with_pid(cmd, pid_file) - pid_file - end - - def stop_nats_tunnel(pid_file) - kill_process(pid_file) - end - - private - def run_with_pid(cmd, pidfile, opts = {}) - env = opts[:env] || {} - output = opts[:output] || "/dev/null" - - unless process_running?(pidfile) - pid = fork do - $stdin.reopen("/dev/null") - [ $stdout, $stderr ].each { |stream| stream.reopen(output, "w") } - env.each_pair { |k, v| ENV[k] = v } - exec cmd - end - - Process.detach(pid) - File.open(pidfile, "w") { |f| f.write(pid) } - - tries = 0 - - while !process_running?(pidfile) - tries += 1 - raise RuntimeError, "Cannot run '#{cmd}' with #{env.inspect}" if tries > 5 - sleep(1) - end - end - end - - def process_running?(pidfile) - begin - File.exists?(pidfile) && Process.kill(0, File.read(pidfile).to_i) - rescue Errno::ESRCH - FileUtils.rm pidfile - false - end - end - - def kill_process(pidfile, signal="TERM") - return unless process_running?(pidfile) - pid = File.read(pidfile).to_i - - Process.kill(signal, pid) - sleep(1) while process_running?(pidfile) - - rescue Errno::ESRCH - puts "Not found process with PID=#{pid} (pidfile #{pidfile})" - ensure - FileUtils.rm_rf pidfile - end - end - end -end diff --git a/encryption/Gemfile b/encryption/Gemfile index d37d2db5b12..6db42ac4318 100644 --- a/encryption/Gemfile +++ b/encryption/Gemfile @@ -7,11 +7,13 @@ group :test, :development do gem "ci_reporter" gem "rspec", "~>2.10" - gem "ruby-debug", :platforms => :ruby_18 - gem "ruby-debug19", :platforms => :ruby_19 - gem "rcov", :platforms => :ruby_18 gem "simplecov", :platforms => :ruby_19 gem "simplecov-rcov", :platforms => :ruby_19 end + +group :development do + gem "ruby-debug", :platforms => :ruby_18 + gem "ruby-debug19", :platforms => :ruby_19 +end \ No newline at end of file diff --git a/encryption/Gemfile.lock b/encryption/Gemfile.lock index 5a2d95661f7..80dda96fd84 100644 --- a/encryption/Gemfile.lock +++ b/encryption/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - bosh_encryption (0.0.3) + bosh_encryption (0.0.4) gibberish (~> 1.2.0) uuidtools (~> 2.1.2) yajl-ruby @@ -53,8 +53,8 @@ GEM simplecov-html (0.5.3) simplecov-rcov (0.2.3) simplecov (>= 0.4.1) - uuidtools (2.1.2) - yajl-ruby (0.8.3) + uuidtools (2.1.3) + yajl-ruby (1.1.0) PLATFORMS ruby diff --git a/encryption/vendor/cache/uuidtools-2.1.2.gem b/encryption/vendor/cache/uuidtools-2.1.2.gem deleted file mode 100644 index 5f302bcb118..00000000000 Binary files a/encryption/vendor/cache/uuidtools-2.1.2.gem and /dev/null differ diff --git a/encryption/vendor/cache/uuidtools-2.1.3.gem b/encryption/vendor/cache/uuidtools-2.1.3.gem new file mode 100644 index 00000000000..a489d97c00f Binary files /dev/null and b/encryption/vendor/cache/uuidtools-2.1.3.gem differ diff --git a/encryption/vendor/cache/yajl-ruby-1.1.0.gem b/encryption/vendor/cache/yajl-ruby-1.1.0.gem new file mode 100644 index 00000000000..3fcb580e813 Binary files /dev/null and b/encryption/vendor/cache/yajl-ruby-1.1.0.gem differ diff --git a/health_monitor/Gemfile.lock b/health_monitor/Gemfile.lock index 03dcc7be144..b218b4a37a8 100644 --- a/health_monitor/Gemfile.lock +++ b/health_monitor/Gemfile.lock @@ -67,7 +67,7 @@ GEM rack (>= 1.0.0) tilt (1.3) uuidtools (2.1.2) - yajl-ruby (0.8.2) + yajl-ruby (0.8.3) PLATFORMS ruby diff --git a/health_monitor/vendor/cache/yajl-ruby-0.8.2.gem b/health_monitor/vendor/cache/yajl-ruby-0.8.2.gem deleted file mode 100644 index f423463a3a9..00000000000 Binary files a/health_monitor/vendor/cache/yajl-ruby-0.8.2.gem and /dev/null differ diff --git a/encryption/vendor/cache/yajl-ruby-0.8.3.gem b/health_monitor/vendor/cache/yajl-ruby-0.8.3.gem similarity index 100% rename from encryption/vendor/cache/yajl-ruby-0.8.3.gem rename to health_monitor/vendor/cache/yajl-ruby-0.8.3.gem diff --git a/ruby_vcloud_sdk/Gemfile.lock b/ruby_vcloud_sdk/Gemfile.lock index 9d6ffd2e336..2f6830f5c3c 100644 --- a/ruby_vcloud_sdk/Gemfile.lock +++ b/ruby_vcloud_sdk/Gemfile.lock @@ -20,7 +20,7 @@ GEM nokogiri (1.5.5) nokogiri-diff (0.1.2) nokogiri (~> 1.5) - tdiff (>= 0.3.2, ~> 0.3) + tdiff (~> 0.3, >= 0.3.2) rake (0.9.2.2) rcov (0.9.9) rest-client (1.6.7) diff --git a/ruby_vcloud_sdk/spec/assets/test-config.yml b/ruby_vcloud_sdk/spec/assets/test-config.yml index f81713313e9..2d823ebf2a1 100644 --- a/ruby_vcloud_sdk/spec/assets/test-config.yml +++ b/ruby_vcloud_sdk/spec/assets/test-config.yml @@ -35,4 +35,4 @@ properties: delete_vapp: true testing: cookies: fake-cookie - log_file: /tmp/vcd-cpi-test/debug + log_file: /tmp/vcd-cpi-test-debug diff --git a/ruby_vim_sdk/vendor/cache/builder-3.0.0.gem b/ruby_vim_sdk/vendor/cache/builder-3.0.0.gem deleted file mode 100644 index a2c6d16096e..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/builder-3.0.0.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/builder-3.1.4.gem b/ruby_vim_sdk/vendor/cache/builder-3.1.4.gem new file mode 100644 index 00000000000..b6090be96c1 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/builder-3.1.4.gem differ diff --git a/ruby_vim_sdk/vendor/cache/ci_reporter-1.7.0.gem b/ruby_vim_sdk/vendor/cache/ci_reporter-1.7.0.gem deleted file mode 100644 index 3f12931913a..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/ci_reporter-1.7.0.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/ci_reporter-1.8.3.gem b/ruby_vim_sdk/vendor/cache/ci_reporter-1.8.3.gem new file mode 100644 index 00000000000..d97c11df147 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/ci_reporter-1.8.3.gem differ diff --git a/ruby_vim_sdk/vendor/cache/httpclient-2.2.4.gem b/ruby_vim_sdk/vendor/cache/httpclient-2.2.4.gem deleted file mode 100644 index 3a2bd4b15e3..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/httpclient-2.2.4.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/httpclient-2.3.2.gem b/ruby_vim_sdk/vendor/cache/httpclient-2.3.2.gem new file mode 100644 index 00000000000..ee75820850b Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/httpclient-2.3.2.gem differ diff --git a/ruby_vim_sdk/vendor/cache/multi_json-1.2.0.gem b/ruby_vim_sdk/vendor/cache/multi_json-1.2.0.gem deleted file mode 100644 index 174da71d54c..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/multi_json-1.2.0.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/multi_json-1.5.0.gem b/ruby_vim_sdk/vendor/cache/multi_json-1.5.0.gem new file mode 100644 index 00000000000..adaa5f3b736 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/multi_json-1.5.0.gem differ diff --git a/ruby_vim_sdk/vendor/cache/nokogiri-1.5.2.gem b/ruby_vim_sdk/vendor/cache/nokogiri-1.5.2.gem deleted file mode 100644 index b4bec97071e..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/nokogiri-1.5.2.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/nokogiri-1.5.6.gem b/ruby_vim_sdk/vendor/cache/nokogiri-1.5.6.gem new file mode 100644 index 00000000000..cb13200d1c2 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/nokogiri-1.5.6.gem differ diff --git a/ruby_vim_sdk/vendor/cache/rake-0.9.2.2.gem b/ruby_vim_sdk/vendor/cache/rake-0.9.2.2.gem deleted file mode 100644 index f7239ac279f..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/rake-0.9.2.2.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/rake-10.0.3.gem b/ruby_vim_sdk/vendor/cache/rake-10.0.3.gem new file mode 100644 index 00000000000..f645fa9ff30 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/rake-10.0.3.gem differ diff --git a/ruby_vim_sdk/vendor/cache/rspec-2.10.0.gem b/ruby_vim_sdk/vendor/cache/rspec-2.10.0.gem deleted file mode 100644 index c3b316cd6ab..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/rspec-2.10.0.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/rspec-2.12.0.gem b/ruby_vim_sdk/vendor/cache/rspec-2.12.0.gem new file mode 100644 index 00000000000..eb16c2320a1 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/rspec-2.12.0.gem differ diff --git a/ruby_vim_sdk/vendor/cache/rspec-core-2.10.0.gem b/ruby_vim_sdk/vendor/cache/rspec-core-2.10.0.gem deleted file mode 100644 index c4601022f7a..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/rspec-core-2.10.0.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/rspec-core-2.12.2.gem b/ruby_vim_sdk/vendor/cache/rspec-core-2.12.2.gem new file mode 100644 index 00000000000..11bd31bca19 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/rspec-core-2.12.2.gem differ diff --git a/ruby_vim_sdk/vendor/cache/rspec-expectations-2.10.0.gem b/ruby_vim_sdk/vendor/cache/rspec-expectations-2.10.0.gem deleted file mode 100644 index 50f8fe8e288..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/rspec-expectations-2.10.0.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/rspec-expectations-2.12.1.gem b/ruby_vim_sdk/vendor/cache/rspec-expectations-2.12.1.gem new file mode 100644 index 00000000000..0a02448e2f4 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/rspec-expectations-2.12.1.gem differ diff --git a/ruby_vim_sdk/vendor/cache/rspec-mocks-2.10.1.gem b/ruby_vim_sdk/vendor/cache/rspec-mocks-2.10.1.gem deleted file mode 100644 index 7df6ef6b618..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/rspec-mocks-2.10.1.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/rspec-mocks-2.12.1.gem b/ruby_vim_sdk/vendor/cache/rspec-mocks-2.12.1.gem new file mode 100644 index 00000000000..9e58ab56ecc Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/rspec-mocks-2.12.1.gem differ diff --git a/ruby_vim_sdk/vendor/cache/simplecov-0.6.1.gem b/ruby_vim_sdk/vendor/cache/simplecov-0.6.1.gem deleted file mode 100644 index ed9f4b6f528..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/simplecov-0.6.1.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/simplecov-0.7.1.gem b/ruby_vim_sdk/vendor/cache/simplecov-0.7.1.gem new file mode 100644 index 00000000000..9571c502826 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/simplecov-0.7.1.gem differ diff --git a/ruby_vim_sdk/vendor/cache/simplecov-html-0.5.3.gem b/ruby_vim_sdk/vendor/cache/simplecov-html-0.5.3.gem deleted file mode 100644 index eda2ba491c4..00000000000 Binary files a/ruby_vim_sdk/vendor/cache/simplecov-html-0.5.3.gem and /dev/null differ diff --git a/ruby_vim_sdk/vendor/cache/simplecov-html-0.7.1.gem b/ruby_vim_sdk/vendor/cache/simplecov-html-0.7.1.gem new file mode 100644 index 00000000000..87b65c5a995 Binary files /dev/null and b/ruby_vim_sdk/vendor/cache/simplecov-html-0.7.1.gem differ diff --git a/spec/Gemfile.lock b/spec/Gemfile.lock index 6caa46ee0c2..28a26423e46 100644 --- a/spec/Gemfile.lock +++ b/spec/Gemfile.lock @@ -21,7 +21,7 @@ GEM json_pure (>= 1.6.1) thin (>= 1.3.1) rack (1.4.1) - rake (0.8.7) + rake (10.0.3) redis (3.0.2) rest-client (1.6.3) mime-types (>= 1.16) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0294b811b20..20154455b0f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -102,4 +102,9 @@ def cleanup_bosh end start_sandbox -at_exit { stop_sandbox } + +at_exit do + status = $!.is_a?(::SystemExit) ? $!.status : 1 + stop_sandbox + exit status +end diff --git a/spec/vendor/cache/rake-0.8.7.gem b/spec/vendor/cache/rake-0.8.7.gem deleted file mode 100644 index 0740cec7b0b..00000000000 Binary files a/spec/vendor/cache/rake-0.8.7.gem and /dev/null differ diff --git a/spec/vendor/cache/rake-10.0.3.gem b/spec/vendor/cache/rake-10.0.3.gem new file mode 100644 index 00000000000..f645fa9ff30 Binary files /dev/null and b/spec/vendor/cache/rake-10.0.3.gem differ diff --git a/vcloud_cpi/Gemfile b/vcloud_cpi/Gemfile index cc1fb454673..ddccace28db 100644 --- a/vcloud_cpi/Gemfile +++ b/vcloud_cpi/Gemfile @@ -6,11 +6,13 @@ gem "rake" group :test, :development do gem "rspec" - gem "ruby-debug", :platforms => :ruby_18 - gem "ruby-debug19", :platforms => :ruby_19 - gem "rcov", :platforms => :ruby_18 gem "simplecov", :platforms => :ruby_19 gem "simplecov-rcov", :platforms => :ruby_19 end + +group :development do + gem "ruby-debug", :platforms => :ruby_18 + gem "ruby-debug19", :platforms => :ruby_19 +end \ No newline at end of file diff --git a/vcloud_cpi/lib/cloud/vcloud/cloud.rb b/vcloud_cpi/lib/cloud/vcloud/cloud.rb index c590701c133..82be594ae8c 100644 --- a/vcloud_cpi/lib/cloud/vcloud/cloud.rb +++ b/vcloud_cpi/lib/cloud/vcloud/cloud.rb @@ -528,8 +528,7 @@ def set_agent_env(vm, env) env_path = File.join(path, "env") iso_path = File.join(path, "env.iso") File.open(env_path, "w") { |f| f.write(env_json) } - output = `genisoimage -o #{iso_path} #{env_path} 2>&1` - raise "#{$?.exitstatus} -#{output}" if $?.exitstatus != 0 + gen_iso_image(iso_path, env_path) @client.set_metadata(vm, @vcd["entities"]["vm_metadata_key"], env_json) @@ -544,6 +543,11 @@ def set_agent_env(vm, env) end end + def gen_iso_image(iso_path, env_path) + output = `genisoimage -o #{iso_path} #{env_path} 2>&1` + raise "#{$?.exitstatus} -#{output}" if $?.exitstatus != 0 + end + def delete_vapp_networks(vapp, exclude_nets) exclude = exclude_nets.map { |k,v| v["cloud_properties"]["name"] }.uniq @client.delete_networks(vapp, exclude) diff --git a/vcloud_cpi/spec/assets/test-director-config.yml b/vcloud_cpi/spec/assets/test-director-config.yml index ed90ffca5f1..0ea6c5f93fe 100644 --- a/vcloud_cpi/spec/assets/test-director-config.yml +++ b/vcloud_cpi/spec/assets/test-director-config.yml @@ -70,4 +70,4 @@ cloud: delete_vapp: true testing: cookies: fake-cookie - log_file: /tmp/vcd-cpi-test/debug + log_file: /tmp/vcd-cpi-test-debug diff --git a/vcloud_cpi/spec/unit/cloud_spec.rb b/vcloud_cpi/spec/unit/cloud_spec.rb index 726853451af..8710a13fedc 100644 --- a/vcloud_cpi/spec/unit/cloud_spec.rb +++ b/vcloud_cpi/spec/unit/cloud_spec.rb @@ -212,6 +212,7 @@ module VCloudCloud cloud = VCloudCloud::Cloud.new(cloud_properties) cloud.stub!(:client) { mc } + cloud.stub!(:gen_iso_image) stemcell = cloud.create_stemcell(Test::spec_asset("valid_stemcell.tgz"), {}) @@ -253,6 +254,7 @@ module VCloudCloud cloud = VCloudCloud::Cloud.new(cloud_properties) cloud.stub!(:client) { mc } + cloud.stub!(:gen_iso_image) disk_locality = [] disk_locality << "test_disk_id" @@ -383,6 +385,7 @@ module VCloudCloud cloud = VCloudCloud::Cloud.new(cloud_properties) cloud.stub!(:client) { mc } + cloud.stub!(:gen_iso_image) cloud.configure_networks(vapp.name, test_manifest["network"]) end @@ -455,6 +458,7 @@ module VCloudCloud cloud = VCloudCloud::Cloud.new(cloud_properties) cloud.stub!(:client) { mc } + cloud.stub!(:gen_iso_image) cloud.attach_disk(vapp.name, "test_disk_id") end @@ -486,6 +490,7 @@ module VCloudCloud cloud = VCloudCloud::Cloud.new(cloud_properties) cloud.stub!(:client) { mc } + cloud.stub!(:gen_iso_image) cloud.detach_disk(vapp.name, "test_disk_id") end diff --git a/vsphere_cpi/spec/spec_helper.rb b/vsphere_cpi/spec/spec_helper.rb index 6b3075fdce7..0297339c55d 100644 --- a/vsphere_cpi/spec/spec_helper.rb +++ b/vsphere_cpi/spec/spec_helper.rb @@ -13,7 +13,7 @@ Sequel.extension :migration db = Sequel.sqlite(':memory:') -migration = File.expand_path("../../db/migrations/vsphere_cpi", __FILE__) +migration = File.expand_path("../../db/migrations", __FILE__) Sequel::TimestampMigrator.new(db, migration, :table => "vsphere_cpi_schema").run require 'cloud'