From bab66d59d0dd154c7f2cb5239a962b47a6368267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Thir=C3=A9?= Date: Thu, 28 Nov 2024 01:25:49 +0100 Subject: [PATCH] Tezt/Cloud: Update bakers info dynamically --- tezt/tests/cloud/dal.ml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tezt/tests/cloud/dal.ml b/tezt/tests/cloud/dal.ml index a22f577e9913..65bedc2f791f 100644 --- a/tezt/tests/cloud/dal.ml +++ b/tezt/tests/cloud/dal.ml @@ -946,9 +946,9 @@ type t = { disconnection_state : Disconnect.t option; first_level : int; teztale : Teztale.t option; - aliases : (string, string) Hashtbl.t; + mutable aliases : (string, string) Hashtbl.t; (* mapping from baker addresses to their Tzkt aliases (if known)*) - versions : (string, string) Hashtbl.t; + mutable versions : (string, string) Hashtbl.t; (* mapping from baker addresses to their octez versions (if known) *) } @@ -2593,10 +2593,23 @@ let clean_up t level = Hashtbl.remove t.infos level ; Hashtbl.remove t.metrics level +let update_bakers_infos t = + let* aliases = + let accounts = List.map (fun ({account; _} : baker) -> account) t.bakers in + Network.aliases ~accounts t.configuration.network + in + let* versions = Network.versions t.configuration.network in + t.aliases <- aliases ; + t.versions <- versions ; + Lwt.return_unit + let on_new_level t ?etherlink level = let* () = wait_for_level t level in toplog "Start process level %d" level ; clean_up t (level - t.configuration.blocks_history) ; + let* () = + if level mod 1_000 = 0 then update_bakers_infos t else Lwt.return_unit + in let etherlink_operator = Option.map (fun etherlink -> etherlink.operator.account.public_key_hash) -- GitLab