Sha256: a589761792a7275444fc444faccc2c56e36e06963448cf16c1a6b0812df67512

Contents?: true

Size: 1.89 KB

Versions: 41

Compression:

Stored size: 1.89 KB

Contents

Shindo.tests("AWS::RDS | cluster", ["aws", "rds"]) do
  model_tests(Fog::AWS[:rds].clusters, rds_default_cluster_params) do
    @cluster_id = @instance.id
    @instance.wait_for(20*60) { ready? }
    @cluster_with_final_snapshot = Fog::AWS[:rds].clusters.create(rds_default_cluster_params.merge(:id => uniq_id("fog-snapshot-test"), :backup_retention_period => 1))

    tests("#servers") do
      returns([]) { @instance.servers }
    end

    @server = Fog::AWS[:rds].servers.create(rds_default_server_params.reject { |k,v| [:allocated_storage, :master_username, :password, :backup_retention_period].include?(k) }.merge(:engine => "aurora", :cluster_id => @instance.id, :flavor_id => "db.r3.large"))
    @server.wait_for(20*60) { ready? }

    tests("#servers") do
      @instance.reload
      returns([{"DBInstanceIdentifier" => @server.id, "master" => true}]) { @instance.db_cluster_members }
      returns([@server]) { @instance.servers }
    end

    tests("#snapshots") do
      returns([]) { @instance.snapshots }

      snapshot_id = uniq_id("manual-snapshot")
      snapshot = @instance.snapshots.create(:id => snapshot_id)
      returns(snapshot_id) { snapshot.id }
      snapshot.wait_for { ready? }
      returns([snapshot.id]) { @instance.snapshots.map(&:id) }
      snapshot.destroy
    end

    tests("#destroy") do
      snapshot_id = uniq_id("fog-snapshot")

      @instance.servers.map(&:destroy)

      @cluster_with_final_snapshot.wait_for(20*60) { ready? }
      @cluster_with_final_snapshot.destroy(snapshot_id)

      snapshot = Fog::AWS[:rds].cluster_snapshots.get(snapshot_id)
      snapshot.wait_for { ready? }
      returns(snapshot_id) { snapshot.id }
      snapshot.destroy
    end

    after do
      if cluster = Fog::AWS[:rds].clusters.get(@cluster_id)
        unless cluster.state = 'deleting'
          cluster.servers.map(&:destroy)
          cluster.destroy
        end
      end
    end
  end
end

Version data entries

41 entries across 39 versions & 2 rubygems

Version Path
fog-aws-3.12.0 tests/models/rds/cluster_tests.rb
fog-aws-3.11.0 tests/models/rds/cluster_tests.rb
fog-aws-3.10.0 tests/models/rds/cluster_tests.rb
fog-aws-3.9.0 tests/models/rds/cluster_tests.rb
fog-aws-3.8.0 tests/models/rds/cluster_tests.rb
fog-aws-3.7.0 tests/models/rds/cluster_tests.rb
fog-aws-3.6.7 tests/models/rds/cluster_tests.rb
fog-aws-3.6.6 tests/models/rds/cluster_tests.rb
fog-aws-3.6.5 tests/models/rds/cluster_tests.rb
fog-aws-3.6.4 tests/models/rds/cluster_tests.rb
fog-aws-3.6.3 tests/models/rds/cluster_tests.rb
fog-aws-3.6.2 tests/models/rds/cluster_tests.rb
fog-aws-3.5.2 tests/models/rds/cluster_tests.rb
fog-aws-3.5.1 tests/models/rds/cluster_tests.rb
fog-aws-3.5.0 tests/models/rds/cluster_tests.rb
fog-aws-3.4.0 tests/models/rds/cluster_tests.rb
fog-aws-3.3.0 tests/models/rds/cluster_tests.rb
fog-aws-3.2.0 tests/models/rds/cluster_tests.rb
fog-aws-3.1.0 tests/models/rds/cluster_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-aws-2.0.1/tests/models/rds/cluster_tests.rb