From 90b0cfb9ec7ed629e8a4f9b750ae08ee0825cb93 Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Wed, 11 Dec 2024 13:36:55 -0300 Subject: [PATCH] Unit Tests: Fail faster on requests we know will fail --- tests/php/TestAdminNotices.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/php/TestAdminNotices.php b/tests/php/TestAdminNotices.php index 6f1738608..8d831a195 100644 --- a/tests/php/TestAdminNotices.php +++ b/tests/php/TestAdminNotices.php @@ -218,6 +218,15 @@ public function testHostErrorNoticeInAdmin() { remove_all_filters( 'ep_elasticsearch_version' ); + // As we know the call will fail, let's fail faster. + add_filter( + 'ep_pre_request_args', + function ( $args ) { + $args['timeout'] = 1; + return $args; + } + ); + ElasticPress\Elasticsearch::factory()->get_elasticsearch_version( true ); ElasticPress\Screen::factory()->set_current_screen( null ); @@ -252,6 +261,15 @@ public function testHostErrorNoticeInInstall() { delete_site_option( 'ep_need_upgrade_sync', true ); delete_site_option( 'ep_feature_auto_activated_sync' ); + // As we know the call will fail, let's fail faster. + add_filter( + 'ep_pre_request_args', + function ( $args ) { + $args['timeout'] = 1; + return $args; + } + ); + ElasticPress\Elasticsearch::factory()->get_elasticsearch_version( true ); ElasticPress\Screen::factory()->set_current_screen( 'install' );