Sha256: d3668de688589ec55e93c5e0b3c98f3494e7e974db23cd27c016d885541eb0c3

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require "readwritesettings"
require "fakeweb"
require "bosh-bootstrap/network_providers"
require "bosh-bootstrap/network_providers/aws"

describe Bosh::Bootstrap::NetworkProviders::AWS do
  include Bosh::Bootstrap::Cli::Helpers::Settings

  let(:cyoi_provider_client) { instance_double("Cyoi::Providers::Clients::AwsProviderClient") }
  subject { Bosh::Bootstrap::NetworkProviders::AWS.new(cyoi_provider_client) }

  it "is registered" do
    expect(Bosh::Bootstrap::NetworkProviders.provider_class("aws")).to eq(subject.class)
  end

  it "creates EC2 security groups it needs" do
    expected_groups = [
      ["ssh", "ssh", ports: 22],
      ["dns_server", "dns_server", ports: { protocol: "udp", ports: (53..53) }],
      ["bosh", "bosh", ports: [4222, 6868, 25250, 25555, 25777]]
    ]
    expected_groups.each do |security_group_name, description, ports|
      expect(cyoi_provider_client).to receive(:create_security_group).with(security_group_name, description, ports, {})
    end
    subject.perform(settings)
  end

  it "creates VPC security groups it needs" do
    setting "address.vpc_id", "vpc-id-1234"
    expected_groups = [
      ["ssh", "ssh", ports: 22],
      ["dns_server", "dns_server", ports: { protocol: "udp", ports: (53..53) }],
      ["bosh", "bosh", ports: [4222, 6868, 25250, 25555, 25777]]
    ]
    expected_groups.each do |security_group_name, description, ports|
      expect(cyoi_provider_client).to receive(:create_security_group).
        with(security_group_name, description, ports, {vpc_id: "vpc-id-1234"})
    end
    subject.perform(settings)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bosh-bootstrap-0.14.3 spec/unit/network_providers/aws_spec.rb
bosh-bootstrap-0.14.2 spec/unit/network_providers/aws_spec.rb
bosh-bootstrap-0.14.1 spec/unit/network_providers/aws_spec.rb
bosh-bootstrap-0.14.0 spec/unit/network_providers/aws_spec.rb