@@ -237,8 +237,7 @@ module VMUpdateSecurebootCertificatesOnBoot = Generic.MakeStateful (struct
237237 module Io = struct
238238 type input_t = [`ok | `update_available | `update_on_boot ] * bool
239239
240- type output_t =
241- ([`ok | `update_available | `update_on_boot ], string * string list ) result
240+ type output_t = [`ok | `update_available | `update_on_boot ]
242241
243242 let string_of_state = function
244243 | `ok ->
@@ -251,14 +250,7 @@ module VMUpdateSecurebootCertificatesOnBoot = Generic.MakeStateful (struct
251250 let string_of_input_t (state , mark ) =
252251 Printf. sprintf " (%s, mark=%b)" (string_of_state state) mark
253252
254- let string_of_error (code , args ) =
255- Printf. sprintf " %s(%s)" code (String. concat " , " args)
256-
257- let string_of_output_t = function
258- | Ok state ->
259- Printf. sprintf " Ok %s" (string_of_state state)
260- | Error err ->
261- Printf. sprintf " Error %s" (string_of_error err)
253+ let string_of_output_t = string_of_state
262254 end
263255
264256 module State = Test_state. XapiDb
@@ -273,34 +265,21 @@ module VMUpdateSecurebootCertificatesOnBoot = Generic.MakeStateful (struct
273265 let self =
274266 List. nth (Db.VM. get_by_name_label ~__context ~label: name_label) 0
275267 in
276- try
277- Xapi_vm. update_secureboot_certificates_on_boot ~__context ~self ~mark ;
278- Ok (Db.VM. get_secureboot_certificates_state ~__context ~self )
279- with Api_errors. Server_error (code , args ) -> Error (code, args)
268+ Xapi_vm. update_secureboot_certificates_on_boot ~__context ~self ~mark ;
269+ Db.VM. get_secureboot_certificates_state ~__context ~self
280270
281271 let tests =
282272 `QuickAndAutoDocumented
283273 [
284- ((`update_available , true ), Ok `update_on_boot )
285- ; ((`update_on_boot , false ), Ok `update_available )
286- ; ( (`ok , true )
287- , Error
288- ( Api_errors. operation_not_allowed
289- , [
290- " Cannot set update_on_boot: VM.secureboot_certificates_state \
291- is not update_available"
292- ]
293- )
294- )
295- ; ( (`ok , false )
296- , Error
297- ( Api_errors. operation_not_allowed
298- , [
299- " Cannot clear update_on_boot: VM.secureboot_certificates_state \
300- is not update_on_boot"
301- ]
302- )
303- )
274+ (* transitions *)
275+ ((`update_available , true ), `update_on_boot )
276+ ; ((`update_on_boot , false ), `update_available )
277+ (* idempotent: already in desired state *)
278+ ; ((`update_on_boot , true ), `update_on_boot )
279+ ; ((`update_available , false ), `update_available )
280+ (* irrelevant states: no-op, no exception *)
281+ ; ((`ok , true ), `ok )
282+ ; ((`ok , false ), `ok )
304283 ]
305284end )
306285
0 commit comments