Skip to content

Commit d33a9f3

Browse files
author
Joshua Reed
committed
Cleanup.
1 parent 512a9e8 commit d33a9f3

10 files changed

+1
-47
lines changed

api/v1beta2/cloudstackcluster_webhook_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ var _ = Describe("CloudStackCluster webhooks", func() {
5656
})
5757

5858
It("Should reject a CloudStackCluster with IdentityRef not of kind 'Secret'", func() {
59-
dummies.CSCluster.Spec.IdentityRef.Kind = "NewType"
6059
Ω(k8sClient.Create(ctx, dummies.CSCluster)).
6160
Should(MatchError(MatchRegexp(forbiddenRegex, "must be a Secret")))
6261
})
@@ -87,12 +86,10 @@ var _ = Describe("CloudStackCluster webhooks", func() {
8786
Should(MatchError(MatchRegexp(forbiddenRegex, "controlplaneendpoint\\.port")))
8887
})
8988
It("Should reject updates to the CloudStackCluster identity reference kind", func() {
90-
dummies.CSCluster.Spec.IdentityRef.Kind = "NewType"
9189
Ω(k8sClient.Update(ctx, dummies.CSCluster)).
9290
Should(MatchError(MatchRegexp(forbiddenRegex, "identityref\\.kind")))
9391
})
9492
It("Should reject updates to the CloudStackCluster identity reference name", func() {
95-
dummies.CSCluster.Spec.IdentityRef.Name = "NewType"
9693
Ω(k8sClient.Update(ctx, dummies.CSCluster)).
9794
Should(MatchError(MatchRegexp(forbiddenRegex, "identityref\\.name")))
9895
})

api/v1beta2/cloudstackmachine_webhook_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ var _ = Describe("CloudStackMachine webhook", func() {
7272
})
7373

7474
It("should reject a CloudStackMachine with IdentityRef not of kind 'Secret'", func() {
75-
dummies.CSMachine1.Spec.IdentityRef.Kind = "ConfigMap"
7675
Expect(k8sClient.Create(ctx, dummies.CSMachine1)).
7776
Should(MatchError(MatchRegexp(forbiddenRegex, "must be a Secret")))
7877
})
@@ -108,13 +107,11 @@ var _ = Describe("CloudStackMachine webhook", func() {
108107
})
109108

110109
It("should reject identity reference kind updates to the CloudStackMachine", func() {
111-
dummies.CSMachine1.Spec.IdentityRef.Kind = "ConfigMap"
112110
Ω(k8sClient.Update(ctx, dummies.CSMachine1)).
113111
Should(MatchError(MatchRegexp(forbiddenRegex, "identityRef\\.Kind")))
114112
})
115113

116114
It("should reject identity reference name updates to the CloudStackMachine", func() {
117-
dummies.CSMachine1.Spec.IdentityRef.Name = "IdentityConfigMap"
118115
Ω(k8sClient.Update(ctx, dummies.CSMachine1)).
119116
Should(MatchError(MatchRegexp(forbiddenRegex, "identityRef\\.Name")))
120117
})

api/v1beta2/cloudstackmachinetemplate_webhook_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ var _ = Describe("CloudStackMachineTemplate webhook", func() {
6262
})
6363

6464
It("should reject a CloudStackMachineTemplate with IdentityRef not of kind 'Secret'", func() {
65-
dummies.CSMachine1.Spec.IdentityRef.Kind = "ConfigMap"
6665
Expect(k8sClient.Create(ctx, dummies.CSMachine1)).
6766
Should(MatchError(MatchRegexp(forbiddenRegex, "must be a Secret")))
6867
})
@@ -99,13 +98,11 @@ var _ = Describe("CloudStackMachineTemplate webhook", func() {
9998
})
10099

101100
It("should reject identity reference kind updates to the CloudStackMachineTemplate", func() {
102-
dummies.CSMachineTemplate1.Spec.Spec.Spec.IdentityRef.Kind = "configMap"
103101
Ω(k8sClient.Update(ctx, dummies.CSMachineTemplate1)).
104102
Should(MatchError(MatchRegexp(forbiddenRegex, "identityRef\\.Kind")))
105103
})
106104

107105
It("should reject identity reference name updates to the CloudStackMachineTemplate", func() {
108-
dummies.CSMachineTemplate1.Spec.Spec.Spec.IdentityRef.Name = "IDentityConfigMap"
109106
Ω(k8sClient.Update(ctx, dummies.CSMachineTemplate1)).
110107
Should(MatchError(MatchRegexp(forbiddenRegex, "identityRef\\.Name")))
111108
})

pkg/cloud/affinity_groups_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ var _ = Describe("AffinityGroup Unit Tests", func() {
5656
})
5757
It("creates an affinity group", func() {
5858
dummies.SetDummyDomainAndAccount()
59-
dummies.SetDummyDomainID()
6059
ags.EXPECT().GetAffinityGroupByID(dummies.AffinityGroup.ID).Return(nil, -1, errors.New("FakeError"))
6160
ags.EXPECT().NewCreateAffinityGroupParams(dummies.AffinityGroup.Name, dummies.AffinityGroup.Type).
6261
Return(&cloudstack.CreateAffinityGroupParams{})

pkg/cloud/cloud_suite_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ func TestCloud(t *testing.T) {
8989
func FetchIntegTestResources() {
9090
Ω(realCloudClient.ResolveZone(&dummies.CSFailureDomain1.Spec.Zone)).Should(Succeed())
9191
Ω(dummies.CSFailureDomain1.Spec.Zone.ID).ShouldNot(BeEmpty())
92-
dummies.CSMachine1.Status.ZoneID = dummies.CSFailureDomain1.Spec.Zone.ID
9392
dummies.CSMachine1.Spec.DiskOffering.Name = ""
9493
dummies.CSCluster.Spec.ControlPlaneEndpoint.Host = ""
9594
Ω(realCloudClient.GetOrCreateIsolatedNetwork(

pkg/cloud/instance_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ var _ = Describe("Instance", func() {
6666
client = cloud.NewClientFromCSAPIClient(mockClient)
6767

6868
dummies.SetDummyVars()
69-
dummies.SetDummyClusterStatus()
70-
dummies.SetDummyCSMachineStatuses()
7169
})
7270

7371
AfterEach(func() {

pkg/cloud/isolated_network_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ var _ = Describe("Network", func() {
5353
rs = mockClient.Resourcetags.(*csapi.MockResourcetagsServiceIface)
5454
client = cloud.NewClientFromCSAPIClient(mockClient)
5555
dummies.SetDummyVars()
56-
dummies.SetDummyClusterStatus()
5756
})
5857

5958
AfterEach(func() {
@@ -63,7 +62,6 @@ var _ = Describe("Network", func() {
6362
It("calls to create an isolated network when not found", func() {
6463
dummies.Zone1.Network = dummies.ISONet1
6564
dummies.Zone1.Network.ID = ""
66-
dummies.CSCluster.Status.PublicIPNetworkID = dummies.ISONet1.ID
6765

6866
nos.EXPECT().GetNetworkOfferingID(gomock.Any()).Return("someOfferingID", 1, nil)
6967
ns.EXPECT().NewCreateNetworkParams(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).
@@ -107,7 +105,6 @@ var _ = Describe("Network", func() {
107105
Context("for a closed firewall", func() {
108106
It("OpenFirewallRule asks CloudStack to open the firewall", func() {
109107
dummies.Zone1.Network = dummies.ISONet1
110-
dummies.CSCluster.Status.PublicIPNetworkID = dummies.ISONet1.ID
111108
fs.EXPECT().NewCreateEgressFirewallRuleParams(dummies.ISONet1.ID, cloud.NetworkProtocolTCP).
112109
Return(&csapi.CreateEgressFirewallRuleParams{})
113110
fs.EXPECT().CreateEgressFirewallRule(&csapi.CreateEgressFirewallRuleParams{}).
@@ -120,7 +117,6 @@ var _ = Describe("Network", func() {
120117
Context("for an open firewall", func() {
121118
It("OpenFirewallRule asks CloudStack to open the firewall anyway, but doesn't fail", func() {
122119
dummies.Zone1.Network = dummies.ISONet1
123-
dummies.CSCluster.Status.PublicIPNetworkID = dummies.ISONet1.ID
124120

125121
fs.EXPECT().NewCreateEgressFirewallRuleParams(dummies.ISONet1.ID, "tcp").
126122
Return(&csapi.CreateEgressFirewallRuleParams{})

pkg/cloud/network_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ var _ = Describe("Network", func() {
4040
ns = mockClient.Network.(*csapi.MockNetworkServiceIface)
4141
client = cloud.NewClientFromCSAPIClient(mockClient)
4242
dummies.SetDummyVars()
43-
dummies.SetDummyClusterStatus()
4443
})
4544

4645
AfterEach(func() {

pkg/cloud/user_credentials_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ var _ = Describe("User Credentials", func() {
2929

3030
BeforeEach(func() {
3131
dummies.SetDummyVars()
32-
dummies.SetDummyClusterStatus()
33-
dummies.SetDummyCSMachineStatuses()
3432
})
3533

3634
AfterEach(func() {

test/dummies/v1beta2/vars.go

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ func SetDummyCSMachineTemplateVars() {
159159
Namespace: "default",
160160
},
161161
Spec: infrav1.CloudStackMachineSpec{
162-
IdentityRef: &infrav1.CloudStackIdentityReference{
163-
Kind: "Secret",
164-
Name: "IdentitySecret",
165-
},
166162
Template: infrav1.CloudStackResourceIdentifier{
167163
Name: GetYamlVal("CLOUDSTACK_TEMPLATE_NAME"),
168164
},
@@ -192,11 +188,7 @@ func SetDummyCSMachineVars() {
192188
Labels: ClusterLabel,
193189
},
194190
Spec: infrav1.CloudStackMachineSpec{
195-
Name: "test-machine-1",
196-
IdentityRef: &infrav1.CloudStackIdentityReference{
197-
Kind: "Secret",
198-
Name: "IdentitySecret",
199-
},
191+
Name: "test-machine-1",
200192
InstanceID: pointer.String("Instance1"),
201193
Template: infrav1.CloudStackResourceIdentifier{
202194
Name: GetYamlVal("CLOUDSTACK_TEMPLATE_NAME"),
@@ -303,10 +295,6 @@ func SetDummyCAPCClusterVars() {
303295
Labels: ClusterLabel,
304296
},
305297
Spec: infrav1.CloudStackClusterSpec{
306-
IdentityRef: &infrav1.CloudStackIdentityReference{
307-
Kind: "Secret",
308-
Name: "IdentitySecret",
309-
},
310298
ControlPlaneEndpoint: clusterv1.APIEndpoint{Host: EndPointHost, Port: EndPointPort},
311299
FailureDomains: []infrav1.CloudStackFailureDomainSpec{CSFailureDomain1.Spec, CSFailureDomain2.Spec},
312300
},
@@ -358,11 +346,6 @@ func SetDummyDomainAndAccount() {
358346
CSCluster.Spec.Domain = DomainPath
359347
}
360348

361-
// SetDummyDomainAndAccount sets domainID in the CSCluster Status. This is not the default.
362-
func SetDummyDomainID() {
363-
CSCluster.Status.DomainID = "FakeDomainID"
364-
}
365-
366349
// SetDummyCapiCluster resets the values in each of the exported CAPICluster related dummy variables.
367350
func SetDummyCAPIClusterVars() {
368351
CAPICluster = &clusterv1.Cluster{
@@ -395,11 +378,6 @@ func SetDummyBootstrapSecretVar() {
395378
Data: map[string][]byte{"value": make([]byte, 0)}}
396379
}
397380

398-
// Fills in cluster status vars.
399-
func SetDummyClusterStatus() {
400-
CSCluster.Status.LBRuleID = LBRuleID
401-
}
402-
403381
// Sets cluster spec to specified network.
404382
func SetClusterSpecToNet(net *infrav1.Network) {
405383
Zone1.Network = *net
@@ -419,7 +397,3 @@ func SetDummyCAPIMachineVars() {
419397
FailureDomain: pointer.String(Zone1.ID)},
420398
}
421399
}
422-
423-
func SetDummyCSMachineStatuses() {
424-
CSMachine1.Status = infrav1.CloudStackMachineStatus{ZoneID: Zone1.ID}
425-
}

0 commit comments

Comments
 (0)