Skip to content

Commit 1e3310d

Browse files
author
Joshua Reed
committed
Test fixups.
1 parent 7e31e60 commit 1e3310d

31 files changed

+133
-34
lines changed

api/v1beta1/zz_generated.conversion.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/cloudstackfailuredomain_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package v1beta2
1818

1919
import (
20-
"crypto/md5"
20+
"crypto/md5" // #nosec G501 -- weak cryptographic primitive doesn't matter here. Not security related.
2121
"fmt"
2222

2323
corev1 "k8s.io/api/core/v1"
@@ -29,7 +29,7 @@ import (
2929
// In the future we may remove the ability to run multiple clusters in a single namespace, but today
3030
// this is a consequence of being upstream of EKS-A which does run multiple clusters in a single namepace.
3131
func FailureDomainHashedMetaName(fdName, clusterName string) string {
32-
return fmt.Sprintf("%x", md5.Sum([]byte(fdName+clusterName)))
32+
return fmt.Sprintf("%x", md5.Sum([]byte(fdName+clusterName))) // #nosec G401 -- weak cryptographic primitive doesn't matter here. Not security related.
3333
}
3434

3535
const (

controllers/cloudstackaffinitygroup_controller_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ var _ = Describe("CloudStackAffinityGroupReconciler", func() {
3434

3535
It("Should patch back the affinity group as ready after calling GetOrCreateAffinityGroup.", func() {
3636
// Modify failure domain name the same way the cluster controller would.
37-
dummies.CSFailureDomain1.Name = dummies.CSFailureDomain1.Name + "-" + dummies.CSCluster.Name
38-
dummies.CSAffinityGroup.Spec.FailureDomainName = dummies.CSFailureDomain1.Name
37+
dummies.CSAffinityGroup.Spec.FailureDomainName = dummies.CSFailureDomain1.Spec.Name
3938

4039
Ω(k8sClient.Create(ctx, dummies.CSFailureDomain1))
4140
Ω(k8sClient.Create(ctx, dummies.CSAffinityGroup)).Should(Succeed())

controllers/cloudstackmachine_controller_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ var _ = Describe("CloudStackMachineReconciler", func() {
3434
BeforeEach(func() {
3535
dummies.SetDummyVars()
3636
dummies.CSCluster.Spec.FailureDomains = dummies.CSCluster.Spec.FailureDomains[:1]
37-
dummies.CSCluster.Spec.FailureDomains[0].Name = dummies.CSFailureDomain1.Name
38-
dummies.CSFailureDomain1.Spec.Name = dummies.CSFailureDomain1.Spec.Name + "-" + dummies.CSCluster.Name
39-
dummies.CSFailureDomain1.Name = dummies.CSFailureDomain1.Spec.Name
37+
dummies.CSCluster.Spec.FailureDomains[0].Name = dummies.CSFailureDomain1.Spec.Name
4038

4139
SetupTestEnvironment() // Must happen before setting up managers/reconcilers.
4240
Ω(MachineReconciler.SetupWithManager(k8sManager)).Should(Succeed()) // Register the CloudStack MachineReconciler.

test/dummies/v1beta2/vars.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ func SetDummyCAPCClusterVars() {
253253
APIVersion: CSApiVersion,
254254
Kind: "CloudStackFailureDomain"},
255255
ObjectMeta: metav1.ObjectMeta{
256-
Name: "fd1",
256+
Name: infrav1.FailureDomainHashedMetaName("fd1", ClusterName),
257257
Namespace: "default",
258258
UID: "0",
259259
Labels: ClusterLabel},
@@ -266,7 +266,7 @@ func SetDummyCAPCClusterVars() {
266266
APIVersion: CSApiVersion,
267267
Kind: "CloudStackFailureDomain"},
268268
ObjectMeta: metav1.ObjectMeta{
269-
Name: "fd2",
269+
Name: infrav1.FailureDomainHashedMetaName("fd2", ClusterName),
270270
Namespace: "default",
271271
UID: "0",
272272
Labels: ClusterLabel},

test/e2e/config/cloudstack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ variables:
113113
NODE_DRAIN_TIMEOUT: "60s"
114114

115115
CLOUDSTACK_FD1_NAME: "fd1"
116-
CLOUDSTACK_FD1_SECRET_NAME: "secret1"
116+
CLOUDSTACK_FD1_SECRET_NAME: "myendpoint"
117117
CLOUDSTACK_ZONE_NAME: zone1
118118
CLOUDSTACK_INVALID_ZONE_NAME: zoneXXXX
119119
CLOUDSTACK_INVALID_NETWORK_NAME: networkXXXX

test/e2e/data/infrastructure-cloudstack/v1beta2/bases/cluster-with-kcp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spec:
2828
port: 6443
2929
failureDomains:
3030
- name: ${CLOUDSTACK_FD1_NAME}
31-
acsendpoint:
31+
acsEndpoint:
3232
name: ${CLOUDSTACK_FD1_SECRET_NAME}
3333
namespace: default
3434
zone:

test/e2e/data/infrastructure-cloudstack/v1beta2/cluster-template-affinity-group-anti.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ spec:
9393
port: 6443
9494
failureDomains:
9595
- name: ${CLOUDSTACK_FD1_NAME}
96-
acsendpoint:
96+
acsEndpoint:
9797
name: ${CLOUDSTACK_FD1_SECRET_NAME}
9898
namespace: default
9999
zone:

test/e2e/data/infrastructure-cloudstack/v1beta2/cluster-template-affinity-group-pro.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ spec:
9393
port: 6443
9494
failureDomains:
9595
- name: ${CLOUDSTACK_FD1_NAME}
96-
acsendpoint:
96+
acsEndpoint:
9797
name: ${CLOUDSTACK_FD1_SECRET_NAME}
9898
namespace: default
9999
zone:

test/e2e/data/infrastructure-cloudstack/v1beta2/cluster-template-custom-disk-offering.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ spec:
126126
host: ""
127127
port: 6443
128128
failureDomains:
129-
- acsendpoint:
129+
- acsEndpoint:
130130
name: ${CLOUDSTACK_FD1_SECRET_NAME}
131131
namespace: default
132132
name: ${CLOUDSTACK_FD1_NAME}

0 commit comments

Comments
 (0)