Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[aws_cpi] fixed failing test case

  • Loading branch information...
commit 0e9baa1778217fb8ccee31ade2549a876e58c4e1 1 parent 05e2e2c
@pmenglund pmenglund authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 bosh_aws_cpi/spec/unit/instance_manager_spec.rb
View
9 bosh_aws_cpi/spec/unit/instance_manager_spec.rb
@@ -21,12 +21,14 @@
}
end
let(:aws_instances) { double(AWS::EC2::InstanceCollection) }
+ let(:instance) { double(AWS::EC2::Instance, id: 'i-12345678') }
it "should ask AWS to create an instance in the given region, with parameters built up from the given arguments" do
region.stub(:instances).and_return(aws_instances)
region.stub(:subnets).and_return({"sub-123456" => fake_aws_subnet})
- aws_instances.should_receive(:create).with(aws_instance_params).and_return(true)
+ aws_instances.should_receive(:create).with(aws_instance_params).and_return(instance)
+ Bosh::AwsCloud::ResourceWait.stub(:for_instance).with(instance: instance, state: :running)
instance_manager = described_class.new(region, registry, availability_zone_selector)
@@ -56,8 +58,9 @@
region.stub(:subnets).and_return({"sub-123456" => fake_aws_subnet})
aws_instances.should_receive(:create).with(aws_instance_params).and_raise(AWS::EC2::Errors::InvalidIPAddress::InUse)
- aws_instances.should_receive(:create).with(aws_instance_params).and_return(true)
-
+ aws_instances.should_receive(:create).with(aws_instance_params).and_return(instance)
+ Bosh::AwsCloud::ResourceWait.stub(:for_instance).with(instance: instance, state: :running)
+
instance_manager = described_class.new(region, registry, availability_zone_selector)
instance_manager.stub(instance_create_wait_time: 0)
Please sign in to comment.
Something went wrong with that request. Please try again.