File: limit_tests.rb

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (67 lines) | stat: -rw-r--r-- 1,988 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require "test_helper"

describe "Fog::OpenStack::Compute | limits requests" do
  before do
    @rate_limit_format = {
      'regex' => String,
      'uri'   => String,
      'limit' => Array
    }

    @rate_limit_usage_format = {
      'next-available' => String,
      'unit'           => String,
      'verb'           => String,
      'remaining'      => Integer,
      'value'          => Integer
    }

    @absolute_limits_format = {
      'maxServerMeta'           => Integer,
      'maxTotalInstances'       => Integer,
      'maxPersonality'          => Integer,
      'maxImageMeta'            => Integer,
      'maxPersonalitySize'      => Integer,
      'maxSecurityGroupRules'   => Integer,
      'maxTotalKeypairs'        => Integer,
      'maxSecurityGroups'       => Integer,
      'maxTotalCores'           => Integer,
      'maxTotalFloatingIps'     => Integer,
      'maxTotalRAMSize'         => Integer,
      'totalCoresUsed'          => Integer,
      'totalRAMUsed'            => Integer,
      'totalInstancesUsed'      => Integer,
      'totalSecurityGroupsUsed' => Integer,
      'totalFloatingIpsUsed'    => Integer
    }

    @limits_format = {
      'rate'     => Array,
      'absolute' => Hash
    }
  end

  describe "success" do
    describe "#get_limits" do
      it "format" do
        Fog::OpenStack::Compute.new.get_limits.body['limits'].
          must_match_schema(@limits_format)
      end

      it "rate limit format" do
        Fog::OpenStack::Compute.new.get_limits.body['limits']['rate'].
          first.must_match_schema(@rate_limit_format)
      end

      it "rate limit usage format" do
        Fog::OpenStack::Compute.new.get_limits.body['limits']['rate'].
          first['limit'].first.must_match_schema(@rate_limit_usage_format)
      end

      it "absolute limits format" do
        Fog::OpenStack::Compute.new.get_limits.body['limits']['absolute'].
          must_match_schema(@absolute_limits_format)
      end
    end
  end
end