@@ -175,6 +175,10 @@ func TestCreateOrUpdateResource(t *testing.T) {
175175 Namespace : "namespace" ,
176176 },
177177 })
178+ specMock .EXPECT ().Parameters (gomockinternal .AContext (), gomock .Not (gomock .Nil ())).DoAndReturn (func (_ context.Context , group * asoresourcesv1.ResourceGroup ) (* asoresourcesv1.ResourceGroup , error ) {
179+ return group , nil
180+ })
181+ specMock .EXPECT ().WasManaged (gomock .Any ()).Return (false )
178182
179183 ctx := context .Background ()
180184 g .Expect (c .Create (ctx , & asoresourcesv1.ResourceGroup {
@@ -184,6 +188,9 @@ func TestCreateOrUpdateResource(t *testing.T) {
184188 Labels : map [string ]string {
185189 infrav1 .OwnedByClusterLabelKey : clusterName ,
186190 },
191+ Annotations : map [string ]string {
192+ asoannotations .PerResourceSecret : "cluster-aso-secret" ,
193+ },
187194 },
188195 Status : asoresourcesv1.ResourceGroup_STATUS {
189196 Conditions : []conditions.Condition {
@@ -203,6 +210,7 @@ func TestCreateOrUpdateResource(t *testing.T) {
203210 var recerr azure.ReconcileError
204211 g .Expect (errors .As (err , & recerr )).To (BeTrue ())
205212 g .Expect (recerr .IsTransient ()).To (BeTrue ())
213+ g .Expect (recerr .IsTerminal ()).To (BeFalse ())
206214 })
207215
208216 t .Run ("resource is not ready in reconciling state" , func (t * testing.T ) {
@@ -223,6 +231,10 @@ func TestCreateOrUpdateResource(t *testing.T) {
223231 Namespace : "namespace" ,
224232 },
225233 })
234+ specMock .EXPECT ().Parameters (gomockinternal .AContext (), gomock .Not (gomock .Nil ())).DoAndReturn (func (_ context.Context , group * asoresourcesv1.ResourceGroup ) (* asoresourcesv1.ResourceGroup , error ) {
235+ return group , nil
236+ })
237+ specMock .EXPECT ().WasManaged (gomock .Any ()).Return (false )
226238
227239 ctx := context .Background ()
228240 g .Expect (c .Create (ctx , & asoresourcesv1.ResourceGroup {
@@ -232,6 +244,9 @@ func TestCreateOrUpdateResource(t *testing.T) {
232244 Labels : map [string ]string {
233245 infrav1 .OwnedByClusterLabelKey : clusterName ,
234246 },
247+ Annotations : map [string ]string {
248+ asoannotations .PerResourceSecret : "cluster-aso-secret" ,
249+ },
235250 },
236251 Status : asoresourcesv1.ResourceGroup_STATUS {
237252 Conditions : []conditions.Condition {
@@ -268,6 +283,10 @@ func TestCreateOrUpdateResource(t *testing.T) {
268283 Namespace : "namespace" ,
269284 },
270285 })
286+ specMock .EXPECT ().Parameters (gomockinternal .AContext (), gomock .Not (gomock .Nil ())).DoAndReturn (func (_ context.Context , group * asoresourcesv1.ResourceGroup ) (* asoresourcesv1.ResourceGroup , error ) {
287+ return group , nil
288+ })
289+ specMock .EXPECT ().WasManaged (gomock .Any ()).Return (false )
271290
272291 ctx := context .Background ()
273292 g .Expect (c .Create (ctx , & asoresourcesv1.ResourceGroup {
@@ -277,6 +296,9 @@ func TestCreateOrUpdateResource(t *testing.T) {
277296 Labels : map [string ]string {
278297 infrav1 .OwnedByClusterLabelKey : clusterName ,
279298 },
299+ Annotations : map [string ]string {
300+ asoannotations .PerResourceSecret : "cluster-aso-secret" ,
301+ },
280302 },
281303 Status : asoresourcesv1.ResourceGroup_STATUS {
282304 Conditions : []conditions.Condition {
@@ -296,6 +318,7 @@ func TestCreateOrUpdateResource(t *testing.T) {
296318 var recerr azure.ReconcileError
297319 g .Expect (errors .As (err , & recerr )).To (BeTrue ())
298320 g .Expect (recerr .IsTerminal ()).To (BeTrue ())
321+ g .Expect (recerr .IsTransient ()).To (BeFalse ())
299322 })
300323
301324 t .Run ("error getting existing resource" , func (t * testing.T ) {
0 commit comments