From 4f5da69702050cea0ed0c50cca09e5436a84f443 Mon Sep 17 00:00:00 2001
From: Damiano Donati <damiano.donati@gmail.com>
Date: Fri, 17 Dec 2021 14:30:35 +0000
Subject: [PATCH] controller: vsphere: TestPatchMachine check Label map init

---
 pkg/controller/vsphere/machine_scope_test.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pkg/controller/vsphere/machine_scope_test.go b/pkg/controller/vsphere/machine_scope_test.go
index c5362f1c4..063f230f2 100644
--- a/pkg/controller/vsphere/machine_scope_test.go
+++ b/pkg/controller/vsphere/machine_scope_test.go
@@ -401,6 +401,9 @@ func TestPatchMachine(t *testing.T) {
 		{
 			name: "Test changing labels",
 			mutate: func(m *machinev1.Machine) {
+				if m.Labels == nil {
+					m.Labels = map[string]string{}
+				}
 				m.Labels["testlabel"] = "test"
 			},
 			expect: func(m *machinev1.Machine) error {
-- 
GitLab