-
Notifications
You must be signed in to change notification settings - Fork 26
/
quota_test.go
183 lines (180 loc) · 5.9 KB
/
quota_test.go
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
package civogo
import (
"testing"
)
func TestGetQuota(t *testing.T) {
client, server, _ := NewClientForTesting(map[string]string{
"/v2/quota": `{
"id": "44aab548-61ca-11e5-860e-5cf9389be614",
"default_user_id": "ca04ddda-06e1-469a-ad63-27ac3298c42c",
"default_user_email_address": "[email protected]",
"instance_count_limit": 16,
"instance_count_usage": 6,
"cpu_core_limit": 10,
"cpu_core_usage": 3,
"ram_mb_limit": 5120,
"ram_mb_usage": 1536,
"disk_gb_limit": 250,
"disk_gb_usage": 75,
"disk_volume_count_limit": 16,
"disk_volume_count_usage": 6,
"disk_snapshot_count_limit": 30,
"disk_snapshot_count_usage": 0,
"public_ip_address_limit": 16,
"public_ip_address_usage": 6,
"subnet_count_limit": 10,
"subnet_count_usage": 1,
"network_count_limit": 10,
"network_count_usage": 1,
"security_group_limit": 16,
"security_group_usage": 5,
"security_group_rule_limit": 160,
"security_group_rule_usage": 24,
"port_count_limit": 32,
"port_count_usage": 7,
"loadbalancer_count_limit": 16,
"loadbalancer_count_usage": 1,
"objectstore_gb_limit": 1000,
"objectstore_gb_usage": 0,
"database_count_limit": 4,
"database_count_usage": 0,
"database_snapshot_count_limit": 20,
"database_snapshot_count_usage": 0,
"database_cpu_core_limit": 120,
"database_cpu_core_usage": 0,
"database_ram_mb_limit": 786432,
"database_ram_mb_usage": 0,
"database_disk_gb_limit": 7680,
"database_disk_gb_usage": 0
}`,
})
defer server.Close()
got, err := client.GetQuota()
if err != nil {
t.Errorf("Request returned an error: %s", err)
return
}
if got.ID != "44aab548-61ca-11e5-860e-5cf9389be614" {
t.Errorf("Expected %s, got %s", "44aab548-61ca-11e5-860e-5cf9389be614", got.ID)
}
if got.DefaultUserID != "ca04ddda-06e1-469a-ad63-27ac3298c42c" {
t.Errorf("Expected %s, got %s", "ca04ddda-06e1-469a-ad63-27ac3298c42c", got.DefaultUserID)
}
if got.DefaultUserEmailAddress != "[email protected]" {
t.Errorf("Expected %s, got %s", "[email protected]", got.DefaultUserEmailAddress)
}
if got.InstanceCountLimit != 16 {
t.Errorf("Expected %d, got %d", 16, got.InstanceCountLimit)
}
if got.InstanceCountUsage != 6 {
t.Errorf("Expected %d, got %d", 6, got.InstanceCountUsage)
}
if got.CPUCoreLimit != 10 {
t.Errorf("Expected %d, got %d", 10, got.CPUCoreLimit)
}
if got.CPUCoreUsage != 3 {
t.Errorf("Expected %d, got %d", 3, got.CPUCoreUsage)
}
if got.RAMMegabytesLimit != 5120 {
t.Errorf("Expected %d, got %d", 5120, got.RAMMegabytesLimit)
}
if got.RAMMegabytesUsage != 1536 {
t.Errorf("Expected %d, got %d", 1536, got.RAMMegabytesUsage)
}
if got.DiskGigabytesLimit != 250 {
t.Errorf("Expected %d, got %d", 250, got.DiskGigabytesLimit)
}
if got.DiskGigabytesUsage != 75 {
t.Errorf("Expected %d, got %d", 75, got.DiskGigabytesUsage)
}
if got.DiskVolumeCountLimit != 16 {
t.Errorf("Expected %d, got %d", 16, got.DiskVolumeCountLimit)
}
if got.DiskVolumeCountUsage != 6 {
t.Errorf("Expected %d, got %d", 6, got.DiskVolumeCountUsage)
}
if got.DiskSnapshotCountLimit != 30 {
t.Errorf("Expected %d, got %d", 30, got.DiskSnapshotCountLimit)
}
if got.DiskSnapshotCountUsage != 0 {
t.Errorf("Expected %d, got %d", 0, got.DiskSnapshotCountUsage)
}
if got.PublicIPAddressLimit != 16 {
t.Errorf("Expected %d, got %d", 16, got.PublicIPAddressLimit)
}
if got.PublicIPAddressUsage != 6 {
t.Errorf("Expected %d, got %d", 6, got.PublicIPAddressUsage)
}
if got.SubnetCountLimit != 10 {
t.Errorf("Expected %d, got %d", 10, got.SubnetCountLimit)
}
if got.SubnetCountUsage != 1 {
t.Errorf("Expected %d, got %d", 1, got.SubnetCountUsage)
}
if got.NetworkCountLimit != 10 {
t.Errorf("Expected %d, got %d", 10, got.NetworkCountLimit)
}
if got.NetworkCountUsage != 1 {
t.Errorf("Expected %d, got %d", 1, got.NetworkCountUsage)
}
if got.SecurityGroupLimit != 16 {
t.Errorf("Expected %d, got %d", 16, got.SecurityGroupLimit)
}
if got.SecurityGroupUsage != 5 {
t.Errorf("Expected %d, got %d", 5, got.SecurityGroupUsage)
}
if got.SecurityGroupRuleLimit != 160 {
t.Errorf("Expected %d, got %d", 160, got.SecurityGroupRuleLimit)
}
if got.SecurityGroupRuleUsage != 24 {
t.Errorf("Expected %d, got %d", 24, got.SecurityGroupRuleUsage)
}
if got.PortCountLimit != 32 {
t.Errorf("Expected %d, got %d", 32, got.PortCountLimit)
}
if got.PortCountUsage != 7 {
t.Errorf("Expected %d, got %d", 7, got.PortCountUsage)
}
if got.LoadBalancerCountLimit != 16 {
t.Errorf("Expected %d, got %d", 16, got.LoadBalancerCountLimit)
}
if got.LoadBalancerCountUsage != 1 {
t.Errorf("Expected %d, got %d", 1, got.LoadBalancerCountUsage)
}
if got.ObjectStoreGigabytesLimit != 1000 {
t.Errorf("Expected %d, got %d", 1000, got.ObjectStoreGigabytesLimit)
}
if got.ObjectStoreGigabytesUsage != 0 {
t.Errorf("Expected %d, got %d", 0, got.ObjectStoreGigabytesUsage)
}
if got.DatabaseCountLimit != 4 {
t.Errorf("Expected %d, got %d", 4, got.DatabaseCountLimit)
}
if got.DatabaseCountUsage != 0 {
t.Errorf("Expected %d, got %d", 0, got.DatabaseCountUsage)
}
if got.DatabaseSnapshotCountLimit != 20 {
t.Errorf("Expected %d, got %d", 20, got.DatabaseSnapshotCountLimit)
}
if got.DatabaseSnapshotCountUsage != 0 {
t.Errorf("Expected %d, got %d", 0, got.DatabaseSnapshotCountUsage)
}
if got.DatabaseCPUCoreLimit != 120 {
t.Errorf("Expected %d, got %d", 120, got.DatabaseCPUCoreLimit)
}
if got.DatabaseCPUCoreUsage != 0 {
t.Errorf("Expected %d, got %d", 0, got.DatabaseCPUCoreUsage)
}
if got.DatabaseRAMMegabytesLimit != 786432 {
t.Errorf("Expected %d, got %d", 786432, got.DatabaseRAMMegabytesLimit)
}
if got.DatabaseRAMMegabytesUsage != 0 {
t.Errorf("Expected %d, got %d", 0, got.DatabaseRAMMegabytesUsage)
}
if got.DatabaseDiskGigabytesLimit != 7680 {
t.Errorf("Expected %d, got %d", 7680, got.DatabaseDiskGigabytesLimit)
}
if got.DatabaseDiskGigabytesUsage != 0 {
t.Errorf("Expected %d, got %d", 0, got.DatabaseDiskGigabytesUsage)
}
}