Skip to content

Commit 62e4554

Browse files
Updated managers to use counterfeiter build directive. #837
1 parent f5588b4 commit 62e4554

38 files changed

Lines changed: 2526 additions & 1998 deletions

bin/buildAndDeploy.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def runTests() -> None:
6262
if re.match(r"fixtrues|vendor", mod) is None:
6363
clean_mods.append(mod)
6464

65+
## GO VET
6566
go_vet = ['go', 'vet'] + clean_mods
6667
# Not using the 'real' command here because this looks neater.
6768

@@ -70,7 +71,20 @@ def runTests() -> None:
7071
subprocess.run(go_vet, check=True)
7172
except subprocess.CalledProcessError as e:
7273
print(f"[red]>>> Go Vet failed <<<")
73-
sys.exit(e.returncode)
74+
sys.exit(e.returncode)
75+
76+
## GO GENERATE
77+
go_generate = ['go', 'generate', './...']
78+
# Not using the 'real' command here because this looks neater.
79+
80+
print(f'[turquoise2]Running: go generate ./...')
81+
try:
82+
subprocess.run(go_generate, check=True)
83+
except subprocess.CalledProcessError as e:
84+
print(f"[red]>>> Go Generate failed <<<")
85+
sys.exit(e.returncode)
86+
87+
## GO TEST
7488
go_test = ['go', 'test'] + clean_mods
7589
print(f'[turquoise2]Running: go test $(go list ./... | grep -v "fixtures" | grep -v "vendor")')
7690
try:

plugin/managers/account.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.ibm.com/SoftLayer/softlayer-cli/plugin/utils"
1212
)
1313

14+
//counterfeiter:generate -o ../testhelpers/ . AccountManager
1415
type AccountManager interface {
1516
SummaryByDatacenter() (map[string]map[string]int, error)
1617
GetBandwidthPools() ([]datatypes.Network_Bandwidth_Version1_Allotment, error)

plugin/managers/bandwidth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
. "github.ibm.com/SoftLayer/softlayer-cli/plugin/i18n"
1111
)
1212

13+
//counterfeiter:generate -o ../testhelpers/ . BandwidthManager
1314
type BandwidthManager interface {
1415
GetLocationGroup() ([]datatypes.Location_Group, error)
1516
CreatePool(name string, regionId int) (datatypes.Network_Bandwidth_Version1_Allotment, error)

plugin/managers/callapi.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/softlayer/softlayer-go/sl"
1010
)
1111

12+
//counterfeiter:generate -o ../testhelpers/ . CallAPIManager
1213
type CallAPIManager interface {
1314
CallAPI(string, string, sl.Options, string) ([]byte, error)
1415
}

plugin/managers/cdn.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/softlayer/softlayer-go/sl"
1212
)
1313

14+
//counterfeiter:generate -o ../testhelpers/ . CdnManager
1415
type CdnManager interface {
1516
GetNetworkCdnMarketplaceConfigurationMapping() ([]datatypes.Container_Network_CdnMarketplace_Configuration_Mapping, error)
1617
DeleteCDN(uniqueId string) ([]datatypes.Container_Network_CdnMarketplace_Configuration_Mapping, error)

plugin/managers/dedicatedhost.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const (
3333
var existDatacenter = false
3434

3535
// Manages SoftLayer Dedicated host.
36+
//counterfeiter:generate -o ../testhelpers/ . DedicatedHostManager
3637
type DedicatedHostManager interface {
3738
ListGuests(identifier int, cpu int, domain string, hostname string, memory int, tags []string, mask string) ([]datatypes.Virtual_Guest, error)
3839
GenerateOrderTemplate(size, hostname, domain, datacenter string, billing string, routerId int) (datatypes.Container_Product_Order_Virtual_DedicatedHost, error)

plugin/managers/dns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const (
1919
)
2020

2121
// Manage SoftLayer DNS.
22-
// See product information here: http://www.softlayer.com/DOMAIN-SERVICES
22+
//counterfeiter:generate -o ../testhelpers/ . DNSManager
2323
type DNSManager interface {
2424
GetZoneIdFromName(zoneName string) (int, error)
2525
ListZones() ([]datatypes.Dns_Domain, error)

plugin/managers/email.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.ibm.com/SoftLayer/softlayer-cli/plugin/metadata"
1010
)
1111

12+
//counterfeiter:generate -o ../testhelpers/ . EmailManager
1213
type EmailManager interface {
1314
GetNetworkMessageDeliveryAccounts(mask string) ([]datatypes.Network_Message_Delivery_Email_Sendgrid, error)
1415
GetAccountOverview(emailId int) (datatypes.Container_Network_Message_Delivery_Email_Sendgrid_Account, error)

0 commit comments

Comments
 (0)