forked from civo/civogo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quota_test.go
127 lines (124 loc) · 3.93 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
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
}`,
})
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)
}
}