@@ -176,8 +176,8 @@ 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 )
180- vmNameUnplaced := fmt .Sprintf ("%s-%s-vm-2 " , clusterName , mdName1 )
179+ vmName2 := fmt .Sprintf ("%s-%s-vm-2 " , clusterName , mdName2 )
180+ vmNameUnplaced := fmt .Sprintf ("%s-%s-vm-unplaced " , clusterName , mdName1 )
181181 vmNameWrongKind := "not-a-vm"
182182
183183 tests := []struct {
@@ -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 },
@@ -211,11 +211,11 @@ func TestGenerateVMGPlacementAnnotations(t *testing.T) {
211211 vmg : & vmoprv1.VirtualMachineGroup {
212212 Status : vmoprv1.VirtualMachineGroupStatus {
213213 Members : []vmoprv1.VirtualMachineGroupMemberStatus {
214- newVMGMemberStatus (vmName1 , "VirtualMachine" , false , "" ),
214+ newVMGMemberStatus (vmNameUnplaced , "VirtualMachine" , false , "" ),
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