From 9e0725d09dc86c91b889426d71c510dd1bf55f19 Mon Sep 17 00:00:00 2001 From: Igor Zinovyev Date: Tue, 25 Jan 2022 21:34:05 +0300 Subject: [PATCH 1/2] Reduced the data set for Search Sync tests. --- .../php/sync/class-test-jetpack-sync-search.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/projects/plugins/jetpack/tests/php/sync/class-test-jetpack-sync-search.php b/projects/plugins/jetpack/tests/php/sync/class-test-jetpack-sync-search.php index af1290b09f9dc..d9ca9e30255d3 100644 --- a/projects/plugins/jetpack/tests/php/sync/class-test-jetpack-sync-search.php +++ b/projects/plugins/jetpack/tests/php/sync/class-test-jetpack-sync-search.php @@ -70,11 +70,11 @@ public function set_up() { * * @return string[][] */ - public function get_allowed_postmeta_keys() { + public function get_random_allowed_postmeta_keys() { $params = array(); $keys = Modules\Search::get_all_postmeta_keys(); - foreach ( $keys as $k ) { - $params[] = array( $k ); + foreach ( array_rand( $keys, 10 ) as $k ) { + $params[] = array( $keys[ $k ] ); } return $params; @@ -85,11 +85,11 @@ public function get_allowed_postmeta_keys() { * * @return string[][] */ - public function get_allowed_taxonomies() { + public function get_random_allowed_taxonomies() { $params = array(); $keys = Modules\Search::get_all_taxonomies(); - foreach ( $keys as $k ) { - $params[] = array( $k ); + foreach ( array_rand( $keys, 10 ) as $k ) { + $params[] = array( $keys[ $k ] ); } return $params; @@ -167,7 +167,7 @@ public function test_meta_no_overlap() { * Important that we double check the specification format since * this will often get added to. * - * @dataProvider get_allowed_postmeta_keys + * @dataProvider get_random_allowed_postmeta_keys * @param string $key Meta Key. */ public function test_check_postmeta_spec( $key ) { @@ -201,7 +201,7 @@ public function test_check_postmeta_spec( $key ) { /** * Verify that allowed taxonomies are synced. * - * @dataProvider get_allowed_taxonomies + * @dataProvider get_random_allowed_taxonomies * @param string $taxonomy Taxonomy Name. */ public function test_add_taxonomy( $taxonomy ) { From 0149a89220213c9eb08e26c22f0260196831b446 Mon Sep 17 00:00:00 2001 From: Igor Zinovyev Date: Tue, 25 Jan 2022 21:37:02 +0300 Subject: [PATCH 2/2] Added changelog entry. --- .../jetpack/changelog/try-reduce-sync-search-test-data | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/try-reduce-sync-search-test-data diff --git a/projects/plugins/jetpack/changelog/try-reduce-sync-search-test-data b/projects/plugins/jetpack/changelog/try-reduce-sync-search-test-data new file mode 100644 index 0000000000000..4a7dc7ddb1237 --- /dev/null +++ b/projects/plugins/jetpack/changelog/try-reduce-sync-search-test-data @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +Reduced the data set for the Search Sync tests to speed up the process.