From 5301be7ffc7a7ff2bda4ea98ca20a01a5436e3ac Mon Sep 17 00:00:00 2001 From: Dmitrii Pichulin Date: Thu, 15 Aug 2024 17:06:17 +0300 Subject: [PATCH] tests tuning --- tests/NodeTest.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/NodeTest.php b/tests/NodeTest.php index ee5555d..4a893bc 100644 --- a/tests/NodeTest.php +++ b/tests/NodeTest.php @@ -154,7 +154,17 @@ function testNode(): void $block = $nodeW->getLastBlock(); $blocks = $nodeW->getBlocksGeneratedBy( $block->generator(), $heightW - 10, $heightW ); - $blocks = $nodeW->getBlocks( $heightW - 4, $heightW ); + try + { + $blocks = $nodeW->getBlocks( $heightW - 4, $heightW ); + } + catch( Exception $e ) + { + if( false !== strpos( $e->getMessage(), 'HTTP 429' ) ) + sleep( 5 ); + $blocks = $nodeW->getBlocks( $heightW - 4, $heightW ); + } + $this->assertSame( 5, count( $blocks ) ); foreach( $blocks as $block ) foreach( $block->transactions() as $tx ) @@ -411,7 +421,7 @@ function testExceptions(): void $json = $node->get( '/blocks/headers/last' ); $this->catchExceptionOrFail( ExceptionCode::FETCH_URI, function() use ( $node ){ $node->get( '/test' ); } ); - $this->catchExceptionOrFail( ExceptionCode::JSON_DECODE, function() use ( $node ){ $node->get( '/api-docs/favicon-16x16.png' ); } ); + $this->catchExceptionOrFail( ExceptionCode::JSON_DECODE, function() use ( $node ){ $node->get( '/api-docs/index.css' ); } ); $this->catchExceptionOrFail( ExceptionCode::KEY_MISSING, function() use ( $json ){ $json->get( 'x' ); } ); $this->catchExceptionOrFail( ExceptionCode::INT_EXPECTED, function() use ( $json ){ $json->get( 'signature' )->asInt(); } ); $this->catchExceptionOrFail( ExceptionCode::STRING_EXPECTED, function() use ( $json ){ $json->get( 'height' )->asString(); } );