Skip to content

Commit c8c7cf5

Browse files
authored
Fix add tests (#16)
* refactor tests * Decouple Test data from tests * Update listApis and add/refactor tests
1 parent 792b9d5 commit c8c7cf5

65 files changed

Lines changed: 58483 additions & 55134 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,15 @@ MOCKGEN := $(shell pwd)/bin/mockgen
2929
mockgen: ## Download conversion-gen locally if necessary.
3030
$(call go-get-tool,$(MOCKGEN),github.com/golang/mock/mockgen)
3131

32+
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
33+
define go-get-tool
34+
[ -f $(1) ] || { \
35+
set -e ;\
36+
TMP_DIR=$$(mktemp -d) ;\
37+
cd $$TMP_DIR ;\
38+
go mod init tmp ;\
39+
echo "Downloading $(2)" ;\
40+
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
41+
rm -rf $$TMP_DIR ;\
42+
}
43+
endef

cloudstack/AccountService.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,13 @@ type CreateAccountResponse struct {
513513
Cpuavailable string `json:"cpuavailable"`
514514
Cpulimit string `json:"cpulimit"`
515515
Cputotal int64 `json:"cputotal"`
516+
Created string `json:"created"`
516517
Defaultzoneid string `json:"defaultzoneid"`
517518
Domain string `json:"domain"`
518519
Domainid string `json:"domainid"`
519520
Domainpath string `json:"domainpath"`
520521
Groups []string `json:"groups"`
522+
Icon string `json:"icon"`
521523
Id string `json:"id"`
522524
Ipavailable string `json:"ipavailable"`
523525
Iplimit string `json:"iplimit"`
@@ -579,6 +581,7 @@ type CreateAccountResponseUser struct {
579581
Domainid string `json:"domainid"`
580582
Email string `json:"email"`
581583
Firstname string `json:"firstname"`
584+
Icon string `json:"icon"`
582585
Id string `json:"id"`
583586
Iscallerchilddomain bool `json:"iscallerchilddomain"`
584587
Isdefault bool `json:"isdefault"`
@@ -899,11 +902,13 @@ type DisableAccountResponse struct {
899902
Cpuavailable string `json:"cpuavailable"`
900903
Cpulimit string `json:"cpulimit"`
901904
Cputotal int64 `json:"cputotal"`
905+
Created string `json:"created"`
902906
Defaultzoneid string `json:"defaultzoneid"`
903907
Domain string `json:"domain"`
904908
Domainid string `json:"domainid"`
905909
Domainpath string `json:"domainpath"`
906910
Groups []string `json:"groups"`
911+
Icon string `json:"icon"`
907912
Id string `json:"id"`
908913
Ipavailable string `json:"ipavailable"`
909914
Iplimit string `json:"iplimit"`
@@ -965,6 +970,7 @@ type DisableAccountResponseUser struct {
965970
Domainid string `json:"domainid"`
966971
Email string `json:"email"`
967972
Firstname string `json:"firstname"`
973+
Icon string `json:"icon"`
968974
Id string `json:"id"`
969975
Iscallerchilddomain bool `json:"iscallerchilddomain"`
970976
Isdefault bool `json:"isdefault"`
@@ -1074,11 +1080,13 @@ type EnableAccountResponse struct {
10741080
Cpuavailable string `json:"cpuavailable"`
10751081
Cpulimit string `json:"cpulimit"`
10761082
Cputotal int64 `json:"cputotal"`
1083+
Created string `json:"created"`
10771084
Defaultzoneid string `json:"defaultzoneid"`
10781085
Domain string `json:"domain"`
10791086
Domainid string `json:"domainid"`
10801087
Domainpath string `json:"domainpath"`
10811088
Groups []string `json:"groups"`
1089+
Icon string `json:"icon"`
10821090
Id string `json:"id"`
10831091
Ipavailable string `json:"ipavailable"`
10841092
Iplimit string `json:"iplimit"`
@@ -1140,6 +1148,7 @@ type EnableAccountResponseUser struct {
11401148
Domainid string `json:"domainid"`
11411149
Email string `json:"email"`
11421150
Firstname string `json:"firstname"`
1151+
Icon string `json:"icon"`
11431152
Id string `json:"id"`
11441153
Iscallerchilddomain bool `json:"iscallerchilddomain"`
11451154
Isdefault bool `json:"isdefault"`
@@ -1282,6 +1291,10 @@ func (p *ListAccountsParams) toURLValues() url.Values {
12821291
vv := strconv.Itoa(v.(int))
12831292
u.Set("pagesize", vv)
12841293
}
1294+
if v, found := p.p["showicon"]; found {
1295+
vv := strconv.FormatBool(v.(bool))
1296+
u.Set("showicon", vv)
1297+
}
12851298
if v, found := p.p["state"]; found {
12861299
u.Set("state", v.(string))
12871300
}
@@ -1453,6 +1466,21 @@ func (p *ListAccountsParams) GetPagesize() (int, bool) {
14531466
return value, ok
14541467
}
14551468

1469+
func (p *ListAccountsParams) SetShowicon(v bool) {
1470+
if p.p == nil {
1471+
p.p = make(map[string]interface{})
1472+
}
1473+
p.p["showicon"] = v
1474+
}
1475+
1476+
func (p *ListAccountsParams) GetShowicon() (bool, bool) {
1477+
if p.p == nil {
1478+
p.p = make(map[string]interface{})
1479+
}
1480+
value, ok := p.p["showicon"].(bool)
1481+
return value, ok
1482+
}
1483+
14561484
func (p *ListAccountsParams) SetState(v string) {
14571485
if p.p == nil {
14581486
p.p = make(map[string]interface{})
@@ -1585,11 +1613,13 @@ type Account struct {
15851613
Cpuavailable string `json:"cpuavailable"`
15861614
Cpulimit string `json:"cpulimit"`
15871615
Cputotal int64 `json:"cputotal"`
1616+
Created string `json:"created"`
15881617
Defaultzoneid string `json:"defaultzoneid"`
15891618
Domain string `json:"domain"`
15901619
Domainid string `json:"domainid"`
15911620
Domainpath string `json:"domainpath"`
15921621
Groups []string `json:"groups"`
1622+
Icon string `json:"icon"`
15931623
Id string `json:"id"`
15941624
Ipavailable string `json:"ipavailable"`
15951625
Iplimit string `json:"iplimit"`
@@ -1651,6 +1681,7 @@ type AccountUser struct {
16511681
Domainid string `json:"domainid"`
16521682
Email string `json:"email"`
16531683
Firstname string `json:"firstname"`
1684+
Icon string `json:"icon"`
16541685
Id string `json:"id"`
16551686
Iscallerchilddomain bool `json:"iscallerchilddomain"`
16561687
Isdefault bool `json:"isdefault"`
@@ -1893,9 +1924,11 @@ type ProjectAccount struct {
18931924
Cpuavailable string `json:"cpuavailable"`
18941925
Cpulimit string `json:"cpulimit"`
18951926
Cputotal int64 `json:"cputotal"`
1927+
Created string `json:"created"`
18961928
Displaytext string `json:"displaytext"`
18971929
Domain string `json:"domain"`
18981930
Domainid string `json:"domainid"`
1931+
Icon string `json:"icon"`
18991932
Id string `json:"id"`
19001933
Ipavailable string `json:"ipavailable"`
19011934
Iplimit string `json:"iplimit"`
@@ -2030,11 +2063,13 @@ type LockAccountResponse struct {
20302063
Cpuavailable string `json:"cpuavailable"`
20312064
Cpulimit string `json:"cpulimit"`
20322065
Cputotal int64 `json:"cputotal"`
2066+
Created string `json:"created"`
20332067
Defaultzoneid string `json:"defaultzoneid"`
20342068
Domain string `json:"domain"`
20352069
Domainid string `json:"domainid"`
20362070
Domainpath string `json:"domainpath"`
20372071
Groups []string `json:"groups"`
2072+
Icon string `json:"icon"`
20382073
Id string `json:"id"`
20392074
Ipavailable string `json:"ipavailable"`
20402075
Iplimit string `json:"iplimit"`
@@ -2096,6 +2131,7 @@ type LockAccountResponseUser struct {
20962131
Domainid string `json:"domainid"`
20972132
Email string `json:"email"`
20982133
Firstname string `json:"firstname"`
2134+
Icon string `json:"icon"`
20992135
Id string `json:"id"`
21002136
Iscallerchilddomain bool `json:"iscallerchilddomain"`
21012137
Isdefault bool `json:"isdefault"`
@@ -2228,11 +2264,13 @@ type MarkDefaultZoneForAccountResponse struct {
22282264
Cpuavailable string `json:"cpuavailable"`
22292265
Cpulimit string `json:"cpulimit"`
22302266
Cputotal int64 `json:"cputotal"`
2267+
Created string `json:"created"`
22312268
Defaultzoneid string `json:"defaultzoneid"`
22322269
Domain string `json:"domain"`
22332270
Domainid string `json:"domainid"`
22342271
Domainpath string `json:"domainpath"`
22352272
Groups []string `json:"groups"`
2273+
Icon string `json:"icon"`
22362274
Id string `json:"id"`
22372275
Ipavailable string `json:"ipavailable"`
22382276
Iplimit string `json:"iplimit"`
@@ -2294,6 +2332,7 @@ type MarkDefaultZoneForAccountResponseUser struct {
22942332
Domainid string `json:"domainid"`
22952333
Email string `json:"email"`
22962334
Firstname string `json:"firstname"`
2335+
Icon string `json:"icon"`
22972336
Id string `json:"id"`
22982337
Iscallerchilddomain bool `json:"iscallerchilddomain"`
22992338
Isdefault bool `json:"isdefault"`
@@ -2479,11 +2518,13 @@ type UpdateAccountResponse struct {
24792518
Cpuavailable string `json:"cpuavailable"`
24802519
Cpulimit string `json:"cpulimit"`
24812520
Cputotal int64 `json:"cputotal"`
2521+
Created string `json:"created"`
24822522
Defaultzoneid string `json:"defaultzoneid"`
24832523
Domain string `json:"domain"`
24842524
Domainid string `json:"domainid"`
24852525
Domainpath string `json:"domainpath"`
24862526
Groups []string `json:"groups"`
2527+
Icon string `json:"icon"`
24872528
Id string `json:"id"`
24882529
Ipavailable string `json:"ipavailable"`
24892530
Iplimit string `json:"iplimit"`
@@ -2545,6 +2586,7 @@ type UpdateAccountResponseUser struct {
25452586
Domainid string `json:"domainid"`
25462587
Email string `json:"email"`
25472588
Firstname string `json:"firstname"`
2589+
Icon string `json:"icon"`
25482590
Id string `json:"id"`
25492591
Iscallerchilddomain bool `json:"iscallerchilddomain"`
25502592
Isdefault bool `json:"isdefault"`

cloudstack/AddressService.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ type AssociateIpAddressResponse struct {
286286
Domainid string `json:"domainid"`
287287
Fordisplay bool `json:"fordisplay"`
288288
Forvirtualnetwork bool `json:"forvirtualnetwork"`
289+
Hasannotations bool `json:"hasannotations"`
289290
Id string `json:"id"`
290291
Ipaddress string `json:"ipaddress"`
291292
Isportable bool `json:"isportable"`
@@ -918,6 +919,7 @@ type PublicIpAddress struct {
918919
Domainid string `json:"domainid"`
919920
Fordisplay bool `json:"fordisplay"`
920921
Forvirtualnetwork bool `json:"forvirtualnetwork"`
922+
Hasannotations bool `json:"hasannotations"`
921923
Id string `json:"id"`
922924
Ipaddress string `json:"ipaddress"`
923925
Isportable bool `json:"isportable"`
@@ -1066,6 +1068,7 @@ type UpdateIpAddressResponse struct {
10661068
Domainid string `json:"domainid"`
10671069
Fordisplay bool `json:"fordisplay"`
10681070
Forvirtualnetwork bool `json:"forvirtualnetwork"`
1071+
Hasannotations bool `json:"hasannotations"`
10691072
Id string `json:"id"`
10701073
Ipaddress string `json:"ipaddress"`
10711074
Isportable bool `json:"isportable"`

cloudstack/AffinityGroupService.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,9 +977,11 @@ type UpdateVMAffinityGroupResponse struct {
977977
Groupid string `json:"groupid"`
978978
Guestosid string `json:"guestosid"`
979979
Haenable bool `json:"haenable"`
980+
Hasannotations bool `json:"hasannotations"`
980981
Hostid string `json:"hostid"`
981982
Hostname string `json:"hostname"`
982983
Hypervisor string `json:"hypervisor"`
984+
Icon string `json:"icon"`
983985
Id string `json:"id"`
984986
Instancename string `json:"instancename"`
985987
Isdynamicallyscalable bool `json:"isdynamicallyscalable"`
@@ -989,6 +991,7 @@ type UpdateVMAffinityGroupResponse struct {
989991
JobID string `json:"jobid"`
990992
Jobstatus int `json:"jobstatus"`
991993
Keypair string `json:"keypair"`
994+
Lastupdated string `json:"lastupdated"`
992995
Memory int `json:"memory"`
993996
Memoryintfreekbs int64 `json:"memoryintfreekbs"`
994997
Memorykbs int64 `json:"memorykbs"`
@@ -1001,14 +1004,17 @@ type UpdateVMAffinityGroupResponse struct {
10011004
Ostypeid string `json:"ostypeid"`
10021005
Password string `json:"password"`
10031006
Passwordenabled bool `json:"passwordenabled"`
1007+
Pooltype string `json:"pooltype"`
10041008
Project string `json:"project"`
10051009
Projectid string `json:"projectid"`
10061010
Publicip string `json:"publicip"`
10071011
Publicipid string `json:"publicipid"`
1008-
Readonlyuidetails string `json:"readonlyuidetails"`
1012+
Readonlydetails string `json:"readonlydetails"`
1013+
Receivedbytes int64 `json:"receivedbytes"`
10091014
Rootdeviceid int64 `json:"rootdeviceid"`
10101015
Rootdevicetype string `json:"rootdevicetype"`
10111016
Securitygroup []UpdateVMAffinityGroupResponseSecuritygroup `json:"securitygroup"`
1017+
Sentbytes int64 `json:"sentbytes"`
10121018
Serviceofferingid string `json:"serviceofferingid"`
10131019
Serviceofferingname string `json:"serviceofferingname"`
10141020
Servicestate string `json:"servicestate"`

cloudstack/BrocadeVCSService.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ type BrocadeVcsDeviceNetwork struct {
416416
Broadcasturi string `json:"broadcasturi"`
417417
Canusefordeploy bool `json:"canusefordeploy"`
418418
Cidr string `json:"cidr"`
419+
Created string `json:"created"`
419420
Details map[string]string `json:"details"`
420421
Displaynetwork bool `json:"displaynetwork"`
421422
Displaytext string `json:"displaytext"`
@@ -425,6 +426,8 @@ type BrocadeVcsDeviceNetwork struct {
425426
Domainid string `json:"domainid"`
426427
Externalid string `json:"externalid"`
427428
Gateway string `json:"gateway"`
429+
Hasannotations bool `json:"hasannotations"`
430+
Icon string `json:"icon"`
428431
Id string `json:"id"`
429432
Ip6cidr string `json:"ip6cidr"`
430433
Ip6gateway string `json:"ip6gateway"`
@@ -445,10 +448,12 @@ type BrocadeVcsDeviceNetwork struct {
445448
Physicalnetworkid string `json:"physicalnetworkid"`
446449
Project string `json:"project"`
447450
Projectid string `json:"projectid"`
451+
Receivedbytes int64 `json:"receivedbytes"`
448452
Redundantrouter bool `json:"redundantrouter"`
449453
Related string `json:"related"`
450454
Reservediprange string `json:"reservediprange"`
451455
Restartrequired bool `json:"restartrequired"`
456+
Sentbytes int64 `json:"sentbytes"`
452457
Service []BrocadeVcsDeviceNetworkService `json:"service"`
453458
Specifyipranges bool `json:"specifyipranges"`
454459
State string `json:"state"`

0 commit comments

Comments
 (0)