@@ -25,31 +25,33 @@ module BackgroundMode = struct
2525          let  ()  =  printf " Daemon logs:\n %s\n " in 
2626          Writer. flushed (Lazy. force Writer. stdout)
2727    in 
28-     let % bind  ()  =  Daemon.Client. stop_daemon process.client in 
29-     Deferred.Or_error. return  Mina_automation_fixture.Intf. Passed 
28+     let % map  ()  =  Daemon.Client. stop_daemon process.client in 
29+     Mina_automation_fixture.Intf. Passed 
3030end 
3131
3232module  DaemonRecover  =  struct 
3333  type  t  = Mina_automation_fixture.Daemon .before_bootstrap 
3434
3535  let  test_case  (test  : t ) = 
36-     let  daemon =  Daemon. of_config test.config in 
37-     let % bind ()  =  Daemon.Config. generate_keys test.config in 
38-     let  ledger_file =  test.config.dirs.conf ^/  " daemon.json" in 
39-     let % bind ()  = 
40-       Mina_automation_fixture.Daemon. generate_random_config daemon ledger_file
41-     in 
42-     let % bind process =  Daemon. start daemon in 
43-     let % bind.Deferred. Result  ()  = 
44-       Daemon.Client. wait_for_bootstrap process.client () 
45-     in 
46-     let % bind.Deferred. Result  _ =  Daemon.Process. force_kill process in 
47-     let % bind process =  Daemon. start daemon in 
48-     let % bind.Deferred. Result  ()  = 
49-       Daemon.Client. wait_for_bootstrap process.client () 
50-     in 
51-     let % bind ()  =  Daemon.Client. stop_daemon process.client in 
52-     Deferred.Or_error. return Mina_automation_fixture.Intf. Passed 
36+     (let  daemon =  Daemon. of_config test.config in 
37+      let % bind ()  =  Daemon.Config. generate_keys test.config in 
38+      let  ledger_file =  test.config.dirs.conf ^/  " daemon.json" in 
39+      let % bind ()  = 
40+        Mina_automation_fixture.Daemon. generate_random_config daemon ledger_file
41+      in 
42+      let % bind process =  Daemon. start daemon in 
43+      let % bind.Deferred. Result  ()  = 
44+        Daemon.Client. wait_for_bootstrap process.client () 
45+      in 
46+      let % bind.Deferred. Result  _ =  Daemon.Process. force_kill process in 
47+      let % bind process =  Daemon. start daemon in 
48+      let % bind.Deferred. Result  ()  = 
49+        Daemon.Client. wait_for_bootstrap process.client () 
50+      in 
51+      let % map ()  =  Daemon.Client. stop_daemon process.client in 
52+      Ok  ()  )
53+     >> |  function 
54+     |  Ok  () -> Mina_automation_fixture.Intf. Passed  |  Error  err  -> Failed  err
5355end 
5456
5557let  contain_log_output  output  = 
@@ -65,16 +67,16 @@ module LedgerHash = struct
6567    let % bind _ = 
6668      Mina_automation_fixture.Daemon. generate_random_accounts daemon ledger_file
6769    in 
68-     let % bind  hash =  Daemon.Client. ledger_hash client ~ledger_file  in 
69-     Deferred.Or_error. return 
70-       (  if  contain_log_output hash  then 
71-         Mina_automation_fixture.Intf. Failed  " output contains log" 
72-        else  if  not  (String. is_prefix ~prefix: " j" then 
73-          Failed  " invalid ledger hash prefix" 
74-        else  if  Int. ( <>  ) (String. length hash) 52  then 
75-          Failed 
76-           ( Printf. sprintf  " invalid ledger hash length (%d)" String. length hash))
77-        else  Passed  ) 
70+     let % map  hash =  Daemon.Client. ledger_hash client ~ledger_file  in 
71+     if  contain_log_output hash  then 
72+       Mina_automation_fixture.Intf. Failed 
73+         ( Error. of_string  " output contains log" ) 
74+     else  if  not  (String. is_prefix ~prefix: " j" then 
75+       Failed  ( Error. of_string  " invalid ledger hash prefix" ) 
76+     else  if  Int. ( <>  ) (String. length hash) 52  then 
77+       Failed 
78+         ( Error. createf  " invalid ledger hash length (%d)" String. length hash))
79+     else  Passed 
7880end 
7981
8082module  LedgerCurrency  =  struct 
@@ -92,17 +94,16 @@ module LedgerCurrency = struct
9294          Currency.Balance. to_nanomina_int account.balance )
9395      |>  List. sum (module  Int ) ~f: Fn. id
9496    in 
95-     let % bind  output =  Daemon.Client. ledger_currency client ~ledger_file  in 
97+     let % map  output =  Daemon.Client. ledger_currency client ~ledger_file  in 
9698    let  actual =  Scanf. sscanf output " MINA : %f" Fn. id in 
9799    let  total_currency_float =  float_of_int total_currency /.  1000000000.0  in 
98100
99-     Deferred.Or_error. return
100-     @@ 
101101    if  contain_log_output output then 
102-       Mina_automation_fixture.Intf. Failed  " output contains log" 
102+       Mina_automation_fixture.Intf. Failed 
103+         (Error. of_string " output contains log" 
103104    else  if  not  Float. (abs (total_currency_float -  actual) <  0.001 ) then 
104105      Failed 
105-         (Printf. sprintf  " invalid mina total count %f vs %f" 
106+         (Error. createf  " invalid mina total count %f vs %f" 
106107           actual )
107108    else  Passed 
108109end 
@@ -113,15 +114,14 @@ module AdvancedPrintSignatureKind = struct
113114  let  test_case  (test  : t ) = 
114115    let  daemon =  Daemon. of_config test.config in 
115116    let  client =  Daemon. client daemon in 
116-     let % bind  output =  Daemon.Client. advanced_print_signature_kind client in 
117+     let % map  output =  Daemon.Client. advanced_print_signature_kind client in 
117118    let  expected =  " testnet" in 
118119
119-     Deferred.Or_error. return
120-     @@ 
121120    if  contain_log_output output then 
122-       Mina_automation_fixture.Intf. Failed  " output contains log" 
121+       Mina_automation_fixture.Intf. Failed 
122+         (Error. of_string " output contains log" 
123123    else  if  not  (String. equal expected (String. strip output)) then 
124-       Failed  (Printf. sprintf  " invalid signature kind %s vs %s" 
124+       Failed  (Error. createf  " invalid signature kind %s vs %s" 
125125    else  Passed 
126126end 
127127
@@ -137,15 +137,14 @@ module AdvancedCompileTimeConstants = struct
137137    in 
138138    let  temp_file =  Filename. temp_file " commandline" " ledger.json" in 
139139    Yojson.Safe. from_string config_content |>  Yojson.Safe. to_file temp_file ;
140-     let % bind  output = 
140+     let % map  output = 
141141      Daemon.Client. advanced_compile_time_constants client
142142        ~config_file: temp_file
143143    in 
144144
145-     Deferred.Or_error. return
146-     @@ 
147145    if  contain_log_output output then 
148-       Mina_automation_fixture.Intf. Failed  " output contains log" 
146+       Mina_automation_fixture.Intf. Failed 
147+         (Error. of_string " output contains log" 
149148    else  Passed 
150149end 
151150
@@ -155,12 +154,11 @@ module AdvancedConstraintSystemDigests = struct
155154  let  test_case  (test  : t ) = 
156155    let  daemon =  Daemon. of_config test.config in 
157156    let  client =  Daemon. client daemon in 
158-     let % bind  output =  Daemon.Client. advanced_constraint_system_digests client in 
157+     let % map  output =  Daemon.Client. advanced_constraint_system_digests client in 
159158
160-     Deferred.Or_error. return
161-     @@ 
162159    if  contain_log_output output then 
163-       Mina_automation_fixture.Intf. Failed  " output contains log" 
160+       Mina_automation_fixture.Intf. Failed 
161+         (Error. of_string " output contains log" 
164162    else  Passed 
165163end 
166164
0 commit comments