diff --git a/tezt/tests/cloud/layer1.ml b/tezt/tests/cloud/layer1.ml index b99a3e7e39e8217590a854cf849887940ba8c076..5f48322c0aae7c85cc6a642d076aa017446b7fb0 100644 --- a/tezt/tests/cloud/layer1.ml +++ b/tezt/tests/cloud/layer1.ml @@ -337,6 +337,11 @@ type stresstest_conf = {pkh : string; pk : string; tps : int; seed : int} - [migration_offset]: offset that dictates after how many levels a protocol upgrade will be performed via a UAU. + - [accusers]: indices specifying which bakers will run together with accusers + + e.g.: [0,2] means that baker 0 and baker 2 will run with '--with-accuser' + argument. By default, no baker runs with accuser. + - [stresstest]: See the description of [stresstest_conf] *) type configuration = { @@ -346,6 +351,7 @@ type configuration = { stresstest : stresstest_conf option; maintenance_delay : int; migration_offset : int option; + accusers : int list option; } (** A version of the [configuration] partially defined. *) @@ -356,6 +362,7 @@ type partial_configuration = { stresstest : stresstest_conf option; maintenance_delay : int option; migration_offset : int option; + accusers : int list option; } let network_encoding = @@ -382,14 +389,22 @@ let configuration_encoding = stresstest; maintenance_delay; migration_offset; + accusers; } -> - (stake, network, snapshot, stresstest, maintenance_delay, migration_offset)) + ( stake, + network, + snapshot, + stresstest, + maintenance_delay, + migration_offset, + accusers )) (fun ( stake, network, snapshot, stresstest, maintenance_delay, - migration_offset ) -> + migration_offset, + accusers ) -> { stake; network; @@ -397,14 +412,16 @@ let configuration_encoding = stresstest; maintenance_delay; migration_offset; + accusers; }) - (obj6 + (obj7 (opt "stake" @@ list int31) (opt "network" network_encoding) (opt "snapshot" string) (opt "stresstest" stresstest_encoding) (opt "maintenance_delay" int31) - (opt "migration_offset" int31)) + (opt "migration_offset" int31) + (opt "accusers" @@ list int31)) type bootstrap = { agent : Agent.t; @@ -435,7 +452,7 @@ type 'network t = { stresstesters : stresstester list; } -let init_baker_i i (configuration : configuration) cloud ~peers +let init_baker_i i (configuration : configuration) cloud ~peers ~with_accuser (accounts : baker_account list) (agent, node, name) = let delay = i * configuration.maintenance_delay in let* client = @@ -459,6 +476,7 @@ let init_baker_i i (configuration : configuration) cloud ~peers ~name ~delegates:(List.map (fun ({pkh; _} : baker_account) -> pkh) accounts) ~client + ~with_accuser node cloud agent @@ -749,7 +767,12 @@ let init ~(configuration : configuration) cloud next_agent = (fun i accounts -> let ((_, node, _) as agent) = List.nth baker_agents i in let peers = List.filter (( <> ) (Node.point_str node)) peers in - init_baker_i i ~peers configuration cloud accounts agent) + let with_accuser = + match configuration.accusers with + | None -> false + | Some accusers -> (List.mem i) accusers + in + init_baker_i i ~peers ~with_accuser configuration cloud accounts agent) distribution in let* stresstesters = @@ -987,6 +1010,7 @@ let register (module Cli : Scenarios_cli.Layer1) = let maintenance_delay = Cli.maintenance_delay in let snapshot = Cli.snapshot in let migration_offset = Cli.migration_offset in + let accusers = Cli.accusers in match Cli.config with | Some filename -> let conf = parse_conf configuration_encoding filename in @@ -1002,6 +1026,7 @@ let register (module Cli : Scenarios_cli.Layer1) = migration_offset = (if migration_offset <> None then migration_offset else conf.migration_offset); + accusers = (if accusers <> None then accusers else conf.accusers); } | None -> { @@ -1011,6 +1036,7 @@ let register (module Cli : Scenarios_cli.Layer1) = maintenance_delay; snapshot; migration_offset; + accusers; } in let vms_conf = Option.map (parse_conf vms_conf_encoding) Cli.vms_config in @@ -1098,9 +1124,18 @@ let register (module Cli : Scenarios_cli.Layer1) = configuration0.maintenance_delay in let migration_offset = configuration0.migration_offset in + let accusers = configuration0.accusers in if stake = [] then Test.fail "stake parameter can not be empty" ; if snapshot = "" then Test.fail "snapshot parameter can not be empty" ; - {stake; network; snapshot; stresstest; maintenance_delay; migration_offset} + { + stake; + network; + snapshot; + stresstest; + maintenance_delay; + migration_offset; + accusers; + } in toplog "Creating the agents" ; let agents = Cloud.agents cloud in diff --git a/tezt/tests/cloud/scenarios_cli.ml b/tezt/tests/cloud/scenarios_cli.ml index 873ec906ef57cf41b7eef49f74d065a59e5e8703..8c0ab971c11b8000ecf9715ab24a021a64532f0c 100644 --- a/tezt/tests/cloud/scenarios_cli.ml +++ b/tezt/tests/cloud/scenarios_cli.ml @@ -457,6 +457,8 @@ module type Layer1 = sig val vms_config : string option val config : string option + + val accusers : int list option end module Layer1 () = struct @@ -592,4 +594,17 @@ module Layer1 () = struct ~description: "JSON file optionally describing options for the test scenario" () + + let accusers = + Clap.optional + ~section + ~long:"accusers" + ~placeholder:",,,..." + ~description: + "By default, all bakers run without an accuser attached to them. With \ + this option, one can specify which of the bakers from the scenario \ + will run with '--with-accuser' option, meaning that they will run \ + together with their own accuser process." + (Clap.list_of_int ~dummy:[] "accusers") + () end diff --git a/tezt/tests/cloud/tezos.ml b/tezt/tests/cloud/tezos.ml index 37398701c8df994b729abfe214f1bf17da87552b..805084f09de33624034e4c94b5ec64dbdd5bb3ec 100644 --- a/tezt/tests/cloud/tezos.ml +++ b/tezt/tests/cloud/tezos.ml @@ -450,7 +450,8 @@ module Agnostic_baker = struct module Agent = struct let init ?(group = "L1") ?env ?name ~delegates ?(path = Uses.path Constant.octez_agnostic_baker) ~client - ?dal_node_rpc_endpoint ?dal_node_timeout_percentage node cloud agent = + ?dal_node_rpc_endpoint ?dal_node_timeout_percentage ?with_accuser node + cloud agent = let* path = Agent.copy agent ~source:path in let* () = Cloud.register_binary @@ -470,6 +471,7 @@ module Agnostic_baker = struct ~delegates ?dal_node_rpc_endpoint ?dal_node_timeout_percentage + ?with_accuser node client end