From cf18fed678b2ce3a0e081a2f9df4e1f47007f087 Mon Sep 17 00:00:00 2001
From: Adrian Catangiu <adrian@parity.io>
Date: Thu, 8 Sep 2022 15:17:46 +0300
Subject: [PATCH] zombienet: add BEEFY justifications import test (#5855)

* zombienet: add BEEFY justifications import test

* bump zombienet image version

* zombienet: can't retrieve metrics when node paused

* bump zombienet image version to v1.2.54

Signed-off-by: acatangiu <adrian@parity.io>
---
 .../functional/0003-beefy-and-mmr.feature       | 17 +++++++++++++----
 .../functional/0003-beefy-and-mmr.toml          |  2 +-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/polkadot/zombienet_tests/functional/0003-beefy-and-mmr.feature b/polkadot/zombienet_tests/functional/0003-beefy-and-mmr.feature
index 2736cb60cc3..fad890bec9e 100644
--- a/polkadot/zombienet_tests/functional/0003-beefy-and-mmr.feature
+++ b/polkadot/zombienet_tests/functional/0003-beefy-and-mmr.feature
@@ -6,21 +6,28 @@ Creds: config
 validator-0: is up
 validator-1: is up
 validator-2: is up
+validator-3: is up
 
 # Check authority status.
 validator-0: reports node_roles is 4
 validator-1: reports node_roles is 4
 validator-2: reports node_roles is 4
+validator-3: reports node_roles is 4
 
 # BEEFY sanity checks.
 validator-0: reports substrate_beefy_validator_set_id is 0
 validator-1: reports substrate_beefy_validator_set_id is 0
 validator-2: reports substrate_beefy_validator_set_id is 0
+validator-3: reports substrate_beefy_validator_set_id is 0
 
 # Verify voting happens and 1st mandatory block is finalized within 1st session.
 validator-0: reports substrate_beefy_best_block is at least 1 within 60 seconds
 validator-1: reports substrate_beefy_best_block is at least 1 within 60 seconds
 validator-2: reports substrate_beefy_best_block is at least 1 within 60 seconds
+validator-3: reports substrate_beefy_best_block is at least 1 within 60 seconds
+
+# Pause validator-3 and test chain is making progress without it.
+validator-3: pause
 
 # Verify validator sets get changed on new sessions.
 validator-0: reports substrate_beefy_validator_set_id is at least 1 within 70 seconds
@@ -37,8 +44,10 @@ validator-0: reports substrate_beefy_best_block is at least 21 within 130 second
 validator-1: reports substrate_beefy_best_block is at least 21 within 130 seconds
 validator-2: reports substrate_beefy_best_block is at least 21 within 130 seconds
 
-# TODO 1: Custom JS to test BEEFY RPCs
-
-# TODO 2: Custom JS to test MMR RPCs
+# TODO (issue #11972): Custom JS to test BEEFY RPCs
+# TODO (issue #11972): Custom JS to test MMR RPCs
 
-# TODO 3: once zombienet/#227 is implemented: pause+resume nodes to test Justifications Import
+# Resume validator-3 and verify it imports all BEEFY justification and catches up.
+validator-3: resume
+validator-3: reports substrate_beefy_validator_set_id is at least 2 within 30 seconds
+validator-3: reports substrate_beefy_best_block is at least 21 within 30 seconds
diff --git a/polkadot/zombienet_tests/functional/0003-beefy-and-mmr.toml b/polkadot/zombienet_tests/functional/0003-beefy-and-mmr.toml
index 6ac2ec0af7f..1608976abdf 100644
--- a/polkadot/zombienet_tests/functional/0003-beefy-and-mmr.toml
+++ b/polkadot/zombienet_tests/functional/0003-beefy-and-mmr.toml
@@ -8,5 +8,5 @@ command = "polkadot"
 
 [[relaychain.node_groups]]
 name = "validator"
-count = 3
+count = 4
 args = ["--log=beefy=debug", "--beefy", "--enable-offchain-indexing=true"]
-- 
GitLab