Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add travis-ci support #6

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
script: "./ci_build.rb"
rvm:
- 1.9.2
env:
- SUITE=unit
- SUITE=integration
8 changes: 4 additions & 4 deletions agent/spec/functional/agent_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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", {}, {
Expand Down Expand Up @@ -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("")

Expand Down
2 changes: 1 addition & 1 deletion aws_cpi/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions aws_cpi/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ 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)
simplecov-html (0.5.3)
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)
Expand All @@ -118,6 +118,6 @@ DEPENDENCIES
rspec (~> 2.10)
ruby-debug
ruby-debug19
ruby_gntp
simplecov
simplecov-rcov
terminal-notifier-guard
12 changes: 7 additions & 5 deletions aws_cpi/lib/cloud/aws/cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)]
Expand Down
9 changes: 9 additions & 0 deletions aws_cpi/spec/unit/set_vm_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
6 changes: 4 additions & 2 deletions blobstore_client/spec/functional/s3_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
30 changes: 30 additions & 0 deletions ci_build.rb
Original file line number Diff line number Diff line change
@@ -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
Binary file removed cpi/vendor/cache/bosh_common-0.5.0.gem
Binary file not shown.
Binary file added cpi/vendor/cache/bosh_common-0.5.2.gem
Binary file not shown.
Loading