From 90216e2fa6fd066ab9c71b1ab3efb4d150c57472 Mon Sep 17 00:00:00 2001 From: Helena Li Date: Mon, 28 Feb 2022 14:24:14 -0800 Subject: [PATCH] remove snark workers from initialization --- src/app/test_executive/archive_node_test.ml | 5 +--- .../test_executive/chain_reliability_test.ml | 7 +---- src/app/test_executive/gossip_consistency.ml | 28 ++++++++++-------- src/app/test_executive/payments_test.ml | 5 +--- .../test_executive/peers_reliability_test.ml | 10 ++----- .../kubernetes_network.ml | 29 ++++++++++--------- src/lib/integration_test_lib/intf.ml | 2 ++ .../integration_test_lib/wait_condition.ml | 6 ---- 8 files changed, 39 insertions(+), 53 deletions(-) diff --git a/src/app/test_executive/archive_node_test.ml b/src/app/test_executive/archive_node_test.ml index 5f7931d8e62..bd1cdbdcf4a 100644 --- a/src/app/test_executive/archive_node_test.ml +++ b/src/app/test_executive/archive_node_test.ml @@ -39,10 +39,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct let all_nodes = Network.all_nodes network in (* waiting for archive_node does not seem to work *) [%log info] "archive node test: waiting for block producers to initialize" ; - let%bind () = - Malleable_error.List.iter all_nodes ~f:(fun bp -> - wait_for t (Wait_condition.node_to_initialize bp)) - in + let%bind () = wait_for t (Wait_condition.nodes_to_initialize all_nodes) in [%log info] "archive node test: waiting for archive node to initialize" ; let%bind () = wait_for t (Wait_condition.node_to_initialize archive_node) in [%log info] "archive node test: running network for %0.1f minutes" diff --git a/src/app/test_executive/chain_reliability_test.ml b/src/app/test_executive/chain_reliability_test.ml index 508f3767b15..95d1eb65323 100644 --- a/src/app/test_executive/chain_reliability_test.ml +++ b/src/app/test_executive/chain_reliability_test.ml @@ -31,15 +31,10 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct let open Malleable_error.Let_syntax in let logger = Logger.create () in let all_nodes = Network.all_nodes network in - + let%bind () = wait_for t (Wait_condition.nodes_to_initialize all_nodes) in let[@warning "-8"] [ node_a; node_b; node_c ] = Network.block_producers network in - (* TODO: let%bind () = wait_for t (Wait_condition.nodes_to_initialize [node_a; node_b; node_c]) in *) - let%bind () = - Malleable_error.List.iter all_nodes - ~f:(Fn.compose (wait_for t) Wait_condition.node_to_initialize) - in let%bind _ = section "blocks are produced" (wait_for t (Wait_condition.blocks_to_be_produced 2)) diff --git a/src/app/test_executive/gossip_consistency.ml b/src/app/test_executive/gossip_consistency.ml index 114270e2037..a12189d59d6 100644 --- a/src/app/test_executive/gossip_consistency.ml +++ b/src/app/test_executive/gossip_consistency.ml @@ -27,17 +27,17 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct }) } - let wait_for_all_to_initialize ~logger network t = - let open Malleable_error.Let_syntax in - let all_nodes = Network.all_nodes network in - let n = List.length all_nodes in - List.mapi all_nodes ~f:(fun i node -> - let%map () = wait_for t (Wait_condition.node_to_initialize node) in - [%log info] - "gossip_consistency test: Block producer %d (of %d) initialized" - (i + 1) n ; - ()) - |> Malleable_error.all_unit + (* let wait_for_all_to_initialize ~logger network t = + let open Malleable_error.Let_syntax in + let all_nodes = Network.all_nodes network in + let n = List.length all_nodes in + List.mapi all_nodes ~f:(fun i node -> + let%map () = wait_for t (Wait_condition.node_to_initialize node) in + [%log info] + "gossip_consistency test: Block producer %d (of %d) initialized" + (i + 1) n ; + ()) + |> Malleable_error.all_unit *) let send_payments ~logger ~sender_pub_key ~receiver_pub_key ~amount ~fee ~node n = @@ -84,7 +84,11 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct let open Malleable_error.Let_syntax in let logger = Logger.create () in [%log info] "gossip_consistency test: starting..." ; - let%bind () = wait_for_all_to_initialize ~logger network t in + (* let%bind () = wait_for_all_to_initialize ~logger network t in *) + let%bind () = + wait_for t + (Wait_condition.nodes_to_initialize (Network.all_nodes network)) + in [%log info] "gossip_consistency test: done waiting for initializations" ; let receiver_bp = Caml.List.nth (Network.block_producers network) 0 in let%bind receiver_pub_key = Util.pub_key_of_node receiver_bp in diff --git a/src/app/test_executive/payments_test.ml b/src/app/test_executive/payments_test.ml index 45b0373e641..c5fc58ff6af 100644 --- a/src/app/test_executive/payments_test.ml +++ b/src/app/test_executive/payments_test.ml @@ -57,10 +57,7 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct (* fee for user commands *) let fee = Currency.Fee.of_int 10_000_000 in let all_nodes = Network.all_nodes network in - let%bind () = - Malleable_error.List.iter all_nodes - ~f:(Fn.compose (wait_for t) Wait_condition.node_to_initialize) - in + let%bind () = wait_for t (Wait_condition.nodes_to_initialize all_nodes) in let[@warning "-8"] [ untimed_node_a; untimed_node_b; timed_node_a ] = Network.block_producers network in diff --git a/src/app/test_executive/peers_reliability_test.ml b/src/app/test_executive/peers_reliability_test.ml index d9290ccbf31..e2bc5fc1c19 100644 --- a/src/app/test_executive/peers_reliability_test.ml +++ b/src/app/test_executive/peers_reliability_test.ml @@ -32,17 +32,13 @@ module Make (Inputs : Intf.Test.Inputs_intf) = struct let open Malleable_error.Let_syntax in let logger = Logger.create () in let all_nodes = Network.all_nodes network in - let[@warning "-8"] [ node_a; node_b; node_c ] = - Network.block_producers network - in [%log info] "peers_list" ~metadata: [ ("peers", `List (List.map all_nodes ~f:(fun n -> `String (Node.id n)))) ] ; - (* TODO: let%bind () = wait_for t (Wait_condition.nodes_to_initialize [node_a; node_b; node_c]) in *) - let%bind () = - Malleable_error.List.iter all_nodes - ~f:(Fn.compose (wait_for t) Wait_condition.node_to_initialize) + let%bind () = wait_for t (Wait_condition.nodes_to_initialize all_nodes) in + let[@warning "-8"] [ node_a; node_b; node_c ] = + Network.block_producers network in let%bind initial_connectivity_data = Util.fetch_connectivity_data ~logger all_nodes diff --git a/src/lib/integration_test_cloud_engine/kubernetes_network.ml b/src/lib/integration_test_cloud_engine/kubernetes_network.ml index b15dbbbe8ca..83c04851274 100644 --- a/src/lib/integration_test_cloud_engine/kubernetes_network.ml +++ b/src/lib/integration_test_cloud_engine/kubernetes_network.ml @@ -504,8 +504,12 @@ let snark_workers { snark_workers; _ } = snark_workers let archive_nodes { archive_nodes; _ } = archive_nodes -(* TODO: snark workers (until then, pretty sure snark work won't be done) *) -let all_nodes +(* all_nodes returns all *actual* mina nodes; note that a snark_worker is a pod within the network but not technically a mina node, therefore not included here. snark coordinators on the other hand ARE mina nodes *) +let all_nodes { seeds; block_producers; snark_coordinators; archive_nodes; _ } = + List.concat [ seeds; block_producers; snark_coordinators; archive_nodes ] + +(* all_pods returns everything in the network. remember that snark_workers will never initialize and will never sync, and aren't supposed to *) +let all_pods { seeds ; block_producers ; snark_coordinators @@ -516,6 +520,12 @@ let all_nodes List.concat [ seeds; block_producers; snark_coordinators; snark_workers; archive_nodes ] +(* all_non_seed_pods returns everything in the network except seed nodes *) +let all_non_seed_pods + { block_producers; snark_coordinators; snark_workers; archive_nodes; _ } = + List.concat + [ block_producers; snark_coordinators; snark_workers; archive_nodes ] + let keypairs { keypairs; _ } = keypairs let lookup_node_by_pod_id t = Map.find t.nodes_by_pod_id @@ -611,7 +621,6 @@ let initialize ~logger network = res | Ok _ -> [%log info] "Starting the daemons within the pods" ; - let seed_nodes = seeds network in let start_print (node : Node.t) = let open Malleable_error.Let_syntax in [%log info] "starting %s ..." node.pod_id ; @@ -619,20 +628,12 @@ let initialize ~logger network = [%log info] "%s started" node.pod_id ; Malleable_error.return res in - let seed_pod_ids = - seed_nodes - |> List.map ~f:(fun { Node.pod_id; _ } -> pod_id) - |> String.Set.of_list - in - let non_seed_nodes = - network |> all_nodes - |> List.filter ~f:(fun { Node.pod_id; _ } -> - not (String.Set.mem seed_pod_ids pod_id)) - in + let seed_nodes = network |> seeds in + let non_seed_pods = network |> all_non_seed_pods in (* TODO: parallelize (requires accumlative hard errors) *) let%bind () = Malleable_error.List.iter seed_nodes ~f:start_print in (* put a short delay before starting other nodes, to help avoid artifact generation races *) let%bind () = after (Time.Span.of_sec 30.0) |> Deferred.bind ~f:Malleable_error.return in - Malleable_error.List.iter non_seed_nodes ~f:start_print + Malleable_error.List.iter non_seed_pods ~f:start_print diff --git a/src/lib/integration_test_lib/intf.ml b/src/lib/integration_test_lib/intf.ml index cae833621ce..49a1f489a25 100644 --- a/src/lib/integration_test_lib/intf.ml +++ b/src/lib/integration_test_lib/intf.ml @@ -238,6 +238,8 @@ module Dsl = struct val node_to_initialize : Engine.Network.Node.t -> t + val nodes_to_initialize : Engine.Network.Node.t list -> t + val blocks_to_be_produced : int -> t val nodes_to_synchronize : Engine.Network.Node.t list -> t diff --git a/src/lib/integration_test_lib/wait_condition.ml b/src/lib/integration_test_lib/wait_condition.ml index 2dc2d4a5432..e1da917d073 100644 --- a/src/lib/integration_test_lib/wait_condition.ml +++ b/src/lib/integration_test_lib/wait_condition.ml @@ -45,12 +45,6 @@ struct ; hard_timeout = Option.value hard_timeout ~default:t.hard_timeout } - (* TODO: does this actually work if it's run twice? I think not *) - (* - * options: - * - assume nodes have not yet initialized by the time we get here - * - associate additional state to see when initialization was last checked - *) let nodes_to_initialize nodes = let open Network_state in let check () (state : Network_state.t) =