Sha256: fb4174f006e14a8786df6ba53f5f6cb0449b603914fd759d7248258738b64174

Contents?: true

Size: 1.7 KB

Versions: 66

Compression:

Stored size: 1.7 KB

Contents

Shindo.tests('Fog::Compute[:openstack] | quota requests', ['openstack']) do

  @tenant_id = Fog::Compute[:openstack].list_tenants.body['tenants'].first['id']
  @quota_set_format = {
    'key_pairs' => Fixnum,
    'metadata_items' => Fixnum,
    'injected_file_content_bytes' => Fixnum,
    'injected_file_path_bytes' => Fixnum,
    'injected_files' => Fixnum,
    'ram' => Fixnum,
    'floating_ips' => Fixnum,
    'instances' => Fixnum,
    'cores' => Fixnum,
    'security_groups' => Fog::Nullable::Integer,
    'security_group_rules' => Fog::Nullable::Integer,
    'volumes' => Fog::Nullable::Integer,
    'gigabytes' => Fog::Nullable::Integer,
    'id' => String
  }

  tests('success') do

    tests('#get_quota_defaults').formats({ 'quota_set' => @quota_set_format }) do
      Fog::Compute[:openstack].get_quota_defaults(@tenant_id).body
    end

    tests('#get_quota').formats(@quota_set_format) do
      @quota = Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set']
      @quota
    end

    tests('#update_quota') do

      new_values = @quota.merge({
        'floating_ips' => @quota['floating_ips']/2,
        'cores' => @quota['cores']/2
      })

      succeeds do
        Fog::Compute[:openstack].update_quota(@tenant_id, new_values.clone)
      end

      returns(new_values, 'returns new values') do
        Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set']
      end

      # set quota back to old values
      succeeds do
        Fog::Compute[:openstack].update_quota(@tenant_id, @quota.clone)
      end

      # ensure old values are restored
      returns(@quota, 'old values restored') do
        Fog::Compute[:openstack].get_quota(@tenant_id).body['quota_set']
      end

    end

  end
end

Version data entries

66 entries across 66 versions & 7 rubygems

Version Path
fog-1.22.0 tests/openstack/requests/compute/quota_tests.rb
fog-1.21.0 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.20.0.20140305101839 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.20.0.20140305101305 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.19.0.20140212012611 tests/openstack/requests/compute/quota_tests.rb
fog-1.20.0 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/openstack/requests/compute/quota_tests.rb
fog-1.19.0 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/openstack/requests/compute/quota_tests.rb
fog-maestrodev-1.18.0.20131209091424 tests/openstack/requests/compute/quota_tests.rb