From e57be3dfd4b358c9502cc2772e8a5622e913c61d Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Thu, 14 Dec 2023 15:20:28 +0100 Subject: [PATCH 1/3] fix: certificate production test --- tests/test_cert_production.sh | 58 ++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/tests/test_cert_production.sh b/tests/test_cert_production.sh index e4df337..83dd3c7 100755 --- a/tests/test_cert_production.sh +++ b/tests/test_cert_production.sh @@ -34,27 +34,57 @@ echo "Executing block cert production test..." # Get last block number created on the topos polygon edge node last_block_topos=$(get_last_block topos-node-1) echo "Topos subnet last block: $last_block_topos" + +last_block_topos=100 + # Check if certificate with this block number is produced on the topos sequencer -certificate_produced=$(check_certificate_produced topos-sequencer $last_block_topos) -if [ $certificate_produced -eq 0 ]; then - echo "Certificate for block $last_block_topos produced on topos sequencer" -else - echo "Certificate for block $last_block_topos IS NOT produced on topos sequencer" - exit 1 -fi +# Try multiple times to give time to sequencer to sync/catch up +for i in {1..10}; +do + certificate_produced=$(check_certificate_produced topos-sequencer $last_block_topos) + if [ $certificate_produced -eq 0 ]; then + echo "Certificate for block $last_block_topos produced on topos sequencer" + break + else + echo "Certificate for block $last_block_topos IS NOT produced on topos sequencer" + if [[ "$i" != '10' ]]; then + echo "Trying again in 5 seconds for $(($i+1)) time" + sleep 5 + continue + fi + if [ $network_started -eq 1 ]; then + echo "Test failed, shutting down network started for this test" + stop_network + fi + exit 1 + fi +done # Get last block number created on the incal polygon edge node last_block_incal=$(get_last_block incal-node-1) echo "Incal subnet last block: $last_block_incal" # Check if certificate with this block number is produced on the incal sequencer -certificate_produced=$(check_certificate_produced incal-sequencer $last_block_incal) -if [ $certificate_produced -eq 0 ]; then - echo "Certificate for block $last_block_incal produced on incal sequencer" -else - echo "Certificate for block $last_block_incal IS NOT produced on incal sequencer" - exit 1 -fi +for i in {1..10}; +do + certificate_produced=$(check_certificate_produced incal-sequencer $last_block_incal) + if [ $certificate_produced -eq 0 ]; then + echo "Certificate for block $last_block_incal produced on incal sequencer" + break + else + echo "Certificate for block $last_block_incal IS NOT produced on incal sequencer" + if [[ "$i" != '10' ]]; then + echo "Trying again in 5 seconds for $(($i+1)) time" + sleep 5 + continue + fi + if [ $network_started -eq 1 ]; then + echo "Test failed, shutting down network started for this test" + stop_network + fi + exit 1 + fi +done From 846341de514624a377a7f41f4c6ad29a7b13cb66 Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Thu, 14 Dec 2023 16:13:21 +0100 Subject: [PATCH 2/3] fix: remove debug lines --- tests/test_cert_production.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_cert_production.sh b/tests/test_cert_production.sh index 83dd3c7..9ab1b07 100755 --- a/tests/test_cert_production.sh +++ b/tests/test_cert_production.sh @@ -35,8 +35,6 @@ echo "Executing block cert production test..." last_block_topos=$(get_last_block topos-node-1) echo "Topos subnet last block: $last_block_topos" -last_block_topos=100 - # Check if certificate with this block number is produced on the topos sequencer # Try multiple times to give time to sequencer to sync/catch up for i in {1..10}; From ce38c39aa8b4cd1a4da3811a227288b6855b8231 Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Thu, 14 Dec 2023 16:17:03 +0100 Subject: [PATCH 3/3] fix: remove empty line --- tests/test_cert_production.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_cert_production.sh b/tests/test_cert_production.sh index 9ab1b07..f41637a 100755 --- a/tests/test_cert_production.sh +++ b/tests/test_cert_production.sh @@ -34,7 +34,6 @@ echo "Executing block cert production test..." # Get last block number created on the topos polygon edge node last_block_topos=$(get_last_block topos-node-1) echo "Topos subnet last block: $last_block_topos" - # Check if certificate with this block number is produced on the topos sequencer # Try multiple times to give time to sequencer to sync/catch up for i in {1..10};