@@ -70,6 +70,11 @@ func TestSetDeleteOperationAsCompleted(t *testing.T) {
70
70
t .Fatal (err )
71
71
}
72
72
73
+ operationID , err := azcorearm .ParseResourceID ("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.RedHatOpenShift/locations/oz/hcpOperationsStatus/operationID" )
74
+ if err != nil {
75
+ t .Fatal (err )
76
+ }
77
+
73
78
server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
74
79
if r .Method == http .MethodPost {
75
80
request = r
@@ -83,11 +88,12 @@ func TestSetDeleteOperationAsCompleted(t *testing.T) {
83
88
}
84
89
85
90
operationDoc := database .NewOperationDocument (database .OperationRequestDelete , resourceID , internalID )
91
+ operationDoc .OperationID = operationID
86
92
operationDoc .NotificationURI = server .URL
87
93
operationDoc .Status = tt .operationStatus
88
94
89
95
op := operation {
90
- id : "this operation" ,
96
+ id : operationID . Name ,
91
97
doc : operationDoc ,
92
98
logger : slog .Default (),
93
99
}
@@ -104,6 +110,11 @@ func TestSetDeleteOperationAsCompleted(t *testing.T) {
104
110
DoAndReturn (func (ctx context.Context , operationID string , callback func (* database.OperationDocument ) bool ) (bool , error ) {
105
111
return callback (operationDoc ), nil
106
112
})
113
+ if tt .expectAsyncNotification {
114
+ mockDBClient .EXPECT ().
115
+ GetOperationDoc (gomock .Any (), op .id ).
116
+ Return (operationDoc , nil )
117
+ }
107
118
108
119
err = scanner .setDeleteOperationAsCompleted (ctx , op )
109
120
@@ -224,6 +235,11 @@ func TestUpdateOperationStatus(t *testing.T) {
224
235
t .Fatal (err )
225
236
}
226
237
238
+ operationID , err := azcorearm .ParseResourceID ("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.RedHatOpenShift/locations/oz/hcpOperationsStatus/operationID" )
239
+ if err != nil {
240
+ t .Fatal (err )
241
+ }
242
+
227
243
server := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
228
244
if r .Method == http .MethodPost {
229
245
request = r
@@ -237,11 +253,12 @@ func TestUpdateOperationStatus(t *testing.T) {
237
253
}
238
254
239
255
operationDoc := database .NewOperationDocument (database .OperationRequestCreate , resourceID , internalID )
256
+ operationDoc .OperationID = operationID
240
257
operationDoc .NotificationURI = server .URL
241
258
operationDoc .Status = tt .currentOperationStatus
242
259
243
260
op := operation {
244
- id : "this operation" ,
261
+ id : operationID . Name ,
245
262
doc : operationDoc ,
246
263
logger : slog .Default (),
247
264
}
@@ -272,6 +289,11 @@ func TestUpdateOperationStatus(t *testing.T) {
272
289
return false , database .ErrNotFound
273
290
}
274
291
})
292
+ if tt .expectAsyncNotification {
293
+ mockDBClient .EXPECT ().
294
+ GetOperationDoc (gomock .Any (), op .id ).
295
+ Return (operationDoc , nil )
296
+ }
275
297
276
298
err = scanner .updateOperationStatus (ctx , op , tt .updatedOperationStatus , nil )
277
299
0 commit comments