Sha256: 6236b72a8c4074136d7324c8b9bddebc4b75ce41b71110ab468cf7b90ed55911

Contents?: true

Size: 1.88 KB

Versions: 18

Compression:

Stored size: 1.88 KB

Contents

Shindo.tests('AWS::RDS | subnet group requests', ['aws', 'rds']) do
  # random_differentiator
  # Useful when rapidly re-running tests, so we don't have to wait
  # serveral minutes for deleted VPCs/subnets to disappear
  suffix = rand(65536).to_s(16)
  @subnet_group_name = "fog-test-#{suffix}"

  vpc_range = rand(245) + 10
  @vpc = Fog::Compute[:aws].vpcs.create('cidr_block' => "10.#{vpc_range}.0.0/16")

  # Create 4 subnets in this VPC, each one in a different AZ
  subnet_az = 'us-east-1a'
  subnet_range = 8
  @subnets = (1..4).map do
    subnet = Fog::Compute[:aws].create_subnet(@vpc.id, "10.#{vpc_range}.#{subnet_range}.0/24",
      'AvailabilityZone' => subnet_az).body['subnetSet'].first
    subnet_az = subnet_az.succ
    subnet_range *= 2
    subnet
  end

  tests('success') do

    subnet_ids = @subnets.map { |sn| sn['subnetId'] }.to_a

    tests("#create_db_subnet_group").formats(AWS::RDS::Formats::CREATE_DB_SUBNET_GROUP) do
      result = Fog::AWS[:rds].create_db_subnet_group(@subnet_group_name, subnet_ids, 'A subnet group').body

      returns(@subnet_group_name) { result['CreateDBSubnetGroupResult']['DBSubnetGroup']['DBSubnetGroupName'] }
      returns('A subnet group') { result['CreateDBSubnetGroupResult']['DBSubnetGroup']['DBSubnetGroupDescription'] }
      returns(@vpc.id) { result['CreateDBSubnetGroupResult']['DBSubnetGroup']['VpcId'] }
      returns(subnet_ids.sort) { result['CreateDBSubnetGroupResult']['DBSubnetGroup']['Subnets'].sort }

      result
    end

    tests("#describe_db_subnet_groups").formats(AWS::RDS::Formats::DESCRIBE_DB_SUBNET_GROUPS) do
      Fog::AWS[:rds].describe_db_subnet_groups.body
    end

    tests("#delete_db_subnet_group").formats(AWS::RDS::Formats::BASIC) do
      Fog::AWS[:rds].delete_db_subnet_group(@subnet_group_name).body
    end

  end

  @subnets.each do |sn|
    Fog::Compute[:aws].delete_subnet(sn['subnetId'])
  end
  @vpc.destroy

end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
fog-maestrodev-1.19.0.20140212012611 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/aws/requests/rds/subnet_groups_tests.rb
fog-1.19.0 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131209091424 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131209090811 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131206115947 tests/aws/requests/rds/subnet_groups_tests.rb
fog-maestrodev-1.18.0.20131205181604 tests/aws/requests/rds/subnet_groups_tests.rb