Skip to content

Commit b8f3c6f

Browse files
author
Joshua Reed
committed
Started fixing up dummy vars.
1 parent 382c908 commit b8f3c6f

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

pkg/cloud/zone_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ var _ = Describe("Cluster", func() {
4242
client = cloud.NewClientFromCSAPIClient(mockClient)
4343
dummies.SetDummyVars()
4444
dummies.SetDummyDomainAndAccount()
45-
dummies.SetDummyCSApiResponse()
4645
})
4746

4847
AfterEach(func() {

test/dummies/vars.go

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,20 @@ var ( // Declare exported dummy vars.
2727
Net2 capcv1.Network
2828
ISONet1 capcv1.Network
2929
CSISONet1 *capcv1.CloudStackIsolatedNetwork
30-
Domain string
30+
Domain cloud.Domain
31+
DomainPath string
32+
DomainName string
3133
DomainID string
32-
RootDomain string
33-
RootDomainID string
34-
Level2Domain string
34+
Level2Domain cloud.Domain
35+
Level2DomainPath string
36+
Level2DomainName string
3537
Level2DomainID string
36-
Account string
38+
Account cloud.Account
39+
AccountName string
40+
AccountID string
41+
Level2Account cloud.Account
42+
Level2AccountName string
43+
Level2AccountID string
3744
Tags map[string]string
3845
Tag1 map[string]string
3946
Tag2 map[string]string
@@ -55,10 +62,6 @@ var ( // Declare exported dummy vars.
5562
PublicIPID string
5663
EndPointHost string
5764
EndPointPort int32
58-
ListDomainsParams *csapi.ListDomainsParams
59-
ListDomainsResp *csapi.ListDomainsResponse
60-
ListAccountsParams *csapi.ListAccountsParams
61-
ListAccountsResp *csapi.ListAccountsResponse
6265
DiskOffering1 = capcv1.CloudStackResourceDiskOffering{
6366
CloudStackResourceIdentifier: capcv1.CloudStackResourceIdentifier{
6467
Name: "Small",
@@ -224,13 +227,16 @@ func SetDummyZoneVars() {
224227
// SetDummyCAPCClusterVars resets the values in each of the exported CloudStackCluster related dummy variables.
225228
// It is intended to be called in BeforeEach() functions.
226229
func SetDummyCAPCClusterVars() {
227-
Domain = "FakeDomainName"
230+
DomainName = "FakeDomainName"
228231
DomainID = "FakeDomainID"
229-
Level2Domain = "foo/FakeDomainName"
232+
Domain = cloud.Domain{Name: DomainName, ID: DomainID}
233+
Level2DomainName = "foo/FakeDomainName"
230234
Level2DomainID = "FakeLevel2DomainID"
231-
RootDomain = "ROOT"
232-
RootDomainID = "FakeRootDomainID"
233-
Account = "FakeAccountName"
235+
Level2Domain = cloud.Domain{Name: Level2DomainName, ID: Level2DomainID}
236+
AccountName = "FakeAccountName"
237+
Account = cloud.Account{Name: AccountName, Domain: Domain}
238+
AccountName = "FakeLevel2AccountName"
239+
Level2Account = cloud.Account{Name: Level2AccountName, Domain: Level2Domain}
234240
CSApiVersion = "infrastructure.cluster.x-k8s.io/v1beta1"
235241
CSClusterKind = "CloudStackCluster"
236242
CSClusterName = "test-cluster"
@@ -275,10 +281,16 @@ func SetDummyCAPCClusterVars() {
275281
CSISONet1.Spec.ID = ISONet1.ID
276282
}
277283

278-
// SetDummyDomainAndAccount sets domain and account in the CSCluster Spec. This is not the default.
284+
// SetClusterDummyDomainAndAccount sets domain and account in the CSCluster Spec. This is not the default.
285+
func SetClusterDummyDomainAndAccount() {
286+
CSCluster.Spec.Account = AccountName
287+
CSCluster.Spec.Domain = DomainPath
288+
}
289+
290+
// SetClusterDummyDomainAndAccount sets domain and account in the CSCluster Spec. This is not the default.
279291
func SetDummyDomainAndAccount() {
280-
CSCluster.Spec.Account = Account
281-
CSCluster.Spec.Domain = Domain
292+
CSCluster.Spec.Account = AccountName
293+
CSCluster.Spec.Domain = DomainPath
282294
}
283295

284296
// SetDummyDomainAndAccount sets domainID in the CSCluster Status. This is not the default.
@@ -330,15 +342,3 @@ func SetDummyCAPIMachineVars() {
330342
func SetDummyCSMachineStatuses() {
331343
CSMachine1.Status = capcv1.CloudStackMachineStatus{ZoneID: Zone1.ID}
332344
}
333-
334-
func SetDummyCSApiResponse() {
335-
ListDomainsParams = &csapi.ListDomainsParams{}
336-
ListDomainsResp = &csapi.ListDomainsResponse{}
337-
ListDomainsResp.Count = 1
338-
ListDomainsResp.Domains = []*csapi.Domain{{Id: DomainID, Path: "ROOT/" + Domain}, {Id: RootDomainID, Path: "ROOT"}, {Id: Level2DomainID, Path: "ROOT/" + Level2Domain}}
339-
340-
ListAccountsParams = &csapi.ListAccountsParams{}
341-
ListAccountsResp = &csapi.ListAccountsResponse{}
342-
ListAccountsResp.Count = 1
343-
ListAccountsResp.Accounts = []*csapi.Account{{Name: Account}}
344-
}

0 commit comments

Comments
 (0)