@@ -33,9 +33,7 @@ func TestAzureCluster_ValidateCreate(t *testing.T) {
3333 }{
3434 {
3535 name : "azurecluster with pre-existing vnet - valid spec" ,
36- cluster : func () * AzureCluster {
37- return createValidCluster ()
38- }(),
36+ cluster : createValidCluster (),
3937 wantErr : false ,
4038 },
4139 {
@@ -140,9 +138,7 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
140138 },
141139 {
142140 name : "azurecluster with no control plane endpoint - valid spec" ,
143- oldCluster : func () * AzureCluster {
144- return createValidCluster ()
145- }(),
141+ oldCluster : createValidCluster (),
146142 cluster : func () * AzureCluster {
147143 cluster := createValidCluster ()
148144 cluster .Spec .ControlPlaneEndpoint = clusterv1.APIEndpoint {
@@ -155,12 +151,8 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
155151 },
156152 {
157153 name : "azurecluster with pre-existing vnet - valid spec" ,
158- oldCluster : func () * AzureCluster {
159- return createValidCluster ()
160- }(),
161- cluster : func () * AzureCluster {
162- return createValidCluster ()
163- }(),
154+ oldCluster : createValidCluster (),
155+ cluster : createValidCluster (),
164156 wantErr : false ,
165157 },
166158 {
@@ -179,9 +171,7 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
179171 },
180172 {
181173 name : "azurecluster with pre-existing vnet - lack control plane subnet" ,
182- oldCluster : func () * AzureCluster {
183- return createValidCluster ()
184- }(),
174+ oldCluster : createValidCluster (),
185175 cluster : func () * AzureCluster {
186176 cluster := createValidCluster ()
187177 cluster .Spec .NetworkSpec .Subnets = cluster .Spec .NetworkSpec .Subnets [1 :]
@@ -191,9 +181,7 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
191181 },
192182 {
193183 name : "azurecluster with pre-existing vnet - lack node subnet" ,
194- oldCluster : func () * AzureCluster {
195- return createValidCluster ()
196- }(),
184+ oldCluster : createValidCluster (),
197185 cluster : func () * AzureCluster {
198186 cluster := createValidCluster ()
199187 cluster .Spec .NetworkSpec .Subnets = cluster .Spec .NetworkSpec .Subnets [:1 ]
@@ -203,9 +191,7 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
203191 },
204192 {
205193 name : "azurecluster with pre-existing vnet - invalid resourcegroup name" ,
206- oldCluster : func () * AzureCluster {
207- return createValidCluster ()
208- }(),
194+ oldCluster : createValidCluster (),
209195 cluster : func () * AzureCluster {
210196 cluster := createValidCluster ()
211197 cluster .Spec .NetworkSpec .Vnet .ResourceGroup = "invalid-name###"
@@ -215,9 +201,7 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
215201 },
216202 {
217203 name : "azurecluster with pre-existing vnet - invalid subnet name" ,
218- oldCluster : func () * AzureCluster {
219- return createValidCluster ()
220- }(),
204+ oldCluster : createValidCluster (),
221205 cluster : func () * AzureCluster {
222206 cluster := createValidCluster ()
223207 cluster .Spec .NetworkSpec .Subnets = append (cluster .Spec .NetworkSpec .Subnets ,
0 commit comments