From 214b196ce9e77633c3f150784c31b735230a2148 Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Wed, 21 Feb 2024 20:04:50 +0000 Subject: [PATCH] Build/Test Tools: Revert r57684. Changes to the `test_readme_mariadb_version()` test were made in an effort to stabilize the connection tests and CI failures. After the changeset, all multisite tests CI jobs connected and passed, but oddly all single site tests CI jobs repeatedly and consistently failed. Reverting to unblock the CI jobs while continued investigation happens. See #59647. git-svn-id: https://develop.svn.wordpress.org/trunk@57689 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/readme.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/tests/readme.php b/tests/phpunit/tests/readme.php index f10a4aa4f7..7ec762b665 100644 --- a/tests/phpunit/tests/readme.php +++ b/tests/phpunit/tests/readme.php @@ -69,19 +69,16 @@ class Tests_Readme extends WP_UnitTestCase { $readme = file_get_contents( ABSPATH . 'readme.html' ); - preg_match( '#Recommendations.*MariaDB version ([0-9.]*)#s', $readme, $recommended ); - $this->assertCount( 2, $recommended, 'The recommended version was not matched.' ); + preg_match( '#Recommendations.*MariaDB version ([0-9.]*)#s', $readme, $matches ); + $matches[1] = str_replace( '.', '', $matches[1] ); - $all_releases = $this->get_response_body( 'https://mariadb.org/mariadb/all-releases/' ); - $recommended_regex = str_replace( '.', '\.', $recommended[1] ) . '\.\d{1,2}'; // Examples: 10.4.1 or 10.4.22 - $release_date_regex = '(\d{4}-\d{2}-\d{2})'; // Example: 2024-01-01 + $response_body = $this->get_response_body( "https://mariadb.com/kb/en/release-notes-mariadb-{$matches[1]}-series/" ); // Retrieve the date of the first stable release for the recommended branch. - preg_match( "#{$recommended_regex}.*?{$release_date_regex}#", $all_releases, $release_date ); - $this->assertCount( 2, $release_date, 'The release date was not matched.' ); + preg_match( '#.*Stable.*?(\d{2} [A-Za-z]{3} \d{4})#s', $response_body, $mariadb_matches ); // Per https://mariadb.org/about/#maintenance-policy, MariaDB releases are supported for 5 years. - $mariadb_eol = gmdate( 'Y-m-d', strtotime( $release_date[1] . ' +5 years' ) ); + $mariadb_eol = gmdate( 'Y-m-d', strtotime( $mariadb_matches[1] . ' +5 years' ) ); $current_date = gmdate( 'Y-m-d' ); $this->assertLessThan( $mariadb_eol, $current_date, "readme.html's Recommended MariaDB version is too old. Remember to update the WordPress.org Requirements page, too." );