Skip to content

Commit 2fb231d

Browse files
committed
Fix vmg UT errors
Signed-off-by: Gong Zhang <[email protected]>
1 parent 947dffa commit 2fb231d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

controllers/vmware/virtualmachinegroup_reconciler_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func TestGenerateVMGPlacementAnnotations(t *testing.T) {
176176

177177
// Define object names for members
178178
vmName1 := fmt.Sprintf("%s-%s-vm-1", clusterName, mdName1)
179-
vmName2 := fmt.Sprintf("%s-%s-vm-1", clusterName, mdName2)
179+
vmName2 := fmt.Sprintf("%s-%s-vm-2", clusterName, mdName2)
180180
vmNameUnplaced := fmt.Sprintf("%s-%s-vm-2", clusterName, mdName1)
181181
vmNameWrongKind := "not-a-vm"
182182

@@ -199,10 +199,10 @@ func TestGenerateVMGPlacementAnnotations(t *testing.T) {
199199
},
200200
},
201201
},
202-
machineDeployments: []string{clusterName + mdName1, clusterName + mdName2},
202+
machineDeployments: []string{clusterName + "-" + mdName1, clusterName + "-" + mdName2},
203203
wantAnnotations: map[string]string{
204-
fmt.Sprintf("zone.cluster.x-k8s.io/%s", clusterName+mdName1): zoneA,
205-
fmt.Sprintf("zone.cluster.x-k8s.io/%s", clusterName+mdName2): zoneB,
204+
fmt.Sprintf("zone.cluster.x-k8s.io/%s", clusterName+"-"+mdName1): zoneA,
205+
fmt.Sprintf("zone.cluster.x-k8s.io/%s", clusterName+"-"+mdName2): zoneB,
206206
},
207207
wantErr: false,
208208
},
@@ -215,7 +215,7 @@ func TestGenerateVMGPlacementAnnotations(t *testing.T) {
215215
},
216216
},
217217
},
218-
machineDeployments: []string{clusterName + mdName1},
218+
machineDeployments: []string{clusterName + "-" + mdName1},
219219
wantAnnotations: map[string]string{},
220220
wantErr: false,
221221
},
@@ -228,7 +228,7 @@ func TestGenerateVMGPlacementAnnotations(t *testing.T) {
228228
},
229229
},
230230
},
231-
machineDeployments: []string{clusterName + mdName1},
231+
machineDeployments: []string{clusterName + "-" + mdName1},
232232
wantAnnotations: map[string]string{},
233233
wantErr: false,
234234
},
@@ -240,13 +240,13 @@ func TestGenerateVMGPlacementAnnotations(t *testing.T) {
240240
// First VM sets the placement
241241
newVMGMemberStatus(vmName1, "VirtualMachine", true, zoneA),
242242
// Second VM is ignored
243-
newVMGMemberStatus(vmNameUnplaced, "VirtualMachine", true, zoneB),
243+
newVMGMemberStatus(vmName1, "VirtualMachine", true, zoneB),
244244
},
245245
},
246246
},
247-
machineDeployments: []string{clusterName + mdName1},
247+
machineDeployments: []string{clusterName + "-" + mdName1},
248248
wantAnnotations: map[string]string{
249-
fmt.Sprintf("zone.cluster.x-k8s.io/%s", clusterName+mdName1): zoneA,
249+
fmt.Sprintf("zone.cluster.x-k8s.io/%s", clusterName+"-"+mdName1): zoneA,
250250
},
251251
wantErr: false,
252252
},
@@ -260,7 +260,7 @@ func TestGenerateVMGPlacementAnnotations(t *testing.T) {
260260
},
261261
},
262262
},
263-
machineDeployments: []string{clusterName + mdName1},
263+
machineDeployments: []string{clusterName + "-" + mdName1},
264264
wantAnnotations: nil,
265265
wantErr: true,
266266
},

0 commit comments

Comments
 (0)