Skip to content

Commit 8dd14d3

Browse files
committed
reformat mina_automation
1 parent b38bcf8 commit 8dd14d3

File tree

6 files changed

+45
-38
lines changed

6 files changed

+45
-38
lines changed

src/test/mina_automation/daemon.ml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Module to run daemon process.
33
*)
44
open Core
5+
56
open Integration_test_lib
67
open Async
78

@@ -112,7 +113,6 @@ module Client = struct
112113
end
113114

114115
module Config = struct
115-
116116
module ConfigDirs = struct
117117
type t =
118118
{ root_path : string
@@ -143,21 +143,31 @@ module Config = struct
143143
let mina_log t = t.conf ^/ "mina.log"
144144
end
145145

146-
type t = { port : int; dirs : ConfigDirs.t; config: Test_config.t ; runtime_config : Runtime_config.t; genesis_ledger : Genesis_ledger.t }
146+
type t =
147+
{ port : int
148+
; dirs : ConfigDirs.t
149+
; config : Test_config.t
150+
; runtime_config : Runtime_config.t
151+
; genesis_ledger : Genesis_ledger.t
152+
}
147153

148-
let create ?(port = 8031) ~(dirs:ConfigDirs.t) ~(config:Test_config.t) () =
154+
let create ?(port = 8031) ~(dirs : ConfigDirs.t) ~(config : Test_config.t) ()
155+
=
149156
let genesis_ledger = Genesis_ledger.create config.genesis_ledger in
150157
let runtime_config =
151158
Runtime_config_builder.create ~test_config:config ~genesis_ledger
152159
in
153160

154-
Yojson.Safe.to_file (dirs.conf ^/ "daemon.json")
161+
Yojson.Safe.to_file
162+
(dirs.conf ^/ "daemon.json")
155163
(Runtime_config.to_yojson runtime_config) ;
156164

157165
{ port; dirs; config; runtime_config; genesis_ledger }
158166

159167
let default () =
160-
create ~dirs:ConfigDirs.default ~config:(Test_config.default ~constants:Test_config.default_constants) ()
168+
create ~dirs:ConfigDirs.default
169+
~config:(Test_config.default ~constants:Test_config.default_constants)
170+
()
161171

162172
let libp2p_keypair_folder t = ConfigDirs.libp2p_keypair_folder t.dirs
163173

@@ -203,10 +213,11 @@ let archive_blocks_from_files t ~archive_address ~format ?(sleep = 5) blocks =
203213
let%bind _ = archive_blocks t ~archive_address ~format [ block ] () in
204214
after (Time.Span.of_sec (Float.of_int sleep)) )
205215

206-
let of_test_config test_config = {
207-
config = Config.create ~dirs:Config.ConfigDirs.default ~config:test_config ()
216+
let of_test_config test_config =
217+
{ config =
218+
Config.create ~dirs:Config.ConfigDirs.default ~config:test_config ()
208219
; executor = Executor.AutoDetect
209-
}
220+
}
210221

211222
let of_config config = { config; executor = Executor.AutoDetect }
212223

src/test/mina_automation/fixture/daemon.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ module type TestCaseWithBootstrap = TestCase with type t = after_bootstrap
4343

4444
module type TestCaseWithoutBootstrap = TestCase with type t = before_bootstrap
4545

46-
module type TestCaseWithoutBootstrapAndWithSetup = TestCaseWithSetup with type t = Integration_test_lib.Test_config.t
46+
module type TestCaseWithoutBootstrapAndWithSetup =
47+
TestCaseWithSetup with type t = Integration_test_lib.Test_config.t
4748

4849
module Make_FixtureWithBootstrap (M : TestCaseWithBootstrap) :
4950
Fixture with type t = after_bootstrap = struct
@@ -111,10 +112,9 @@ module Make_FixtureWithBootstrapAndFromTestConfig
111112

112113
let test_case = M.test_case
113114

114-
let setup () =
115-
Deferred.Or_error.return ( M.setup () )
115+
let setup () = Deferred.Or_error.return (M.setup ())
116116

117117
let teardown _t = Deferred.Or_error.ok_unit
118118

119119
let on_test_fail _t = Deferred.unit
120-
end
120+
end

src/test/mina_automation/fixture/daemon.mli

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ module type TestCaseWithBootstrap = TestCase with type t = after_bootstrap
1515

1616
module type TestCaseWithoutBootstrap = TestCase with type t = before_bootstrap
1717

18-
module type TestCaseWithoutBootstrapAndWithSetup = TestCaseWithSetup with type t = Integration_test_lib.Test_config.t
18+
module type TestCaseWithoutBootstrapAndWithSetup =
19+
TestCaseWithSetup with type t = Integration_test_lib.Test_config.t
1920

2021
module Make_FixtureWithBootstrap (M : TestCaseWithBootstrap) :
2122
Fixture with type t = after_bootstrap
2223

2324
module Make_FixtureWithoutBootstrap (M : TestCaseWithoutBootstrap) :
2425
Fixture with type t = before_bootstrap
2526

26-
module Make_FixtureWithBootstrapAndFromTestConfig (M : TestCaseWithoutBootstrapAndWithSetup) :
27+
module Make_FixtureWithBootstrapAndFromTestConfig
28+
(M : TestCaseWithoutBootstrapAndWithSetup) :
2729
Fixture with type t = Integration_test_lib.Test_config.t

src/test/mina_automation/fixture/intf.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module type TestCaseWithSetup = sig
1616
val test_case : t -> test_result Deferred.Or_error.t
1717
end
1818

19-
2019
module type Fixture = sig
2120
type t
2221

src/test/mina_automation/js_signer.ml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ open Async
77
open Integration_test_lib
88

99
module Config = struct
10-
11-
type t =
10+
type t =
1211
{ sender_sk : String.t
1312
; receiver_address : String.t
1413
; graphql_url : string option
@@ -27,23 +26,19 @@ let repo_path = "scripts/tests/mina-signer/test-signer.js"
2726

2827
let official_name = "mina-test-signer"
2928

30-
3129
let run config =
3230
let open Deferred.Let_syntax in
3331
let logger = Logger.create () in
3432
match%bind Sys.file_exists repo_path with
35-
| `Yes ->
36-
[%log info]
37-
"Running command node %s" (String.concat ~sep:" " (repo_path :: Config.to_args config));
38-
Util.run_cmd_or_error "." "node"
39-
( [ repo_path ] @ Config.to_args config )
40-
| _ -> (
41-
match Utils.exists_at_path "" official_name with
42-
| Some _ ->
43-
[%log info]
44-
"Running command %s %s" official_name (String.concat ~sep:" " (Config.to_args config));
45-
Util.run_cmd_or_error "" official_name
46-
( Config.to_args config )
47-
| None -> (
48-
Deferred.Or_error.error_string
49-
"Could not find js_signer executable" ) )
33+
| `Yes ->
34+
[%log info] "Running command node %s"
35+
(String.concat ~sep:" " (repo_path :: Config.to_args config)) ;
36+
Util.run_cmd_or_error "." "node" ([ repo_path ] @ Config.to_args config)
37+
| _ -> (
38+
match Utils.exists_at_path "" official_name with
39+
| Some _ ->
40+
[%log info] "Running command %s %s" official_name
41+
(String.concat ~sep:" " (Config.to_args config)) ;
42+
Util.run_cmd_or_error "" official_name (Config.to_args config)
43+
| None ->
44+
Deferred.Or_error.error_string "Could not find js_signer executable" )

src/test/mina_automation/utils.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ let paths =
66
Option.value_map ~f:(String.split ~on:':') ~default:[] (Sys.getenv "PATH")
77

88
let exists_at_path folder file =
9-
match Sys.file_exists (folder ^/ file) with
10-
| `Yes ->
11-
Some (folder ^/ file)
12-
| _ ->
13-
None
9+
match Sys.file_exists (folder ^/ file) with
10+
| `Yes ->
11+
Some (folder ^/ file)
12+
| _ ->
13+
None
1414

1515
let possible_locations ~file possible_locations =
1616
possible_locations @ paths

0 commit comments

Comments
 (0)