Skip to content

Commit

Permalink
[not verified] # This is a combination of 4 commits.
Browse files Browse the repository at this point in the history
Debug tests

- allow skipped tests to be ommited from the Site Health page
- add a test for Sync health

Debug tests: adding a short description for enabling sync

Debug: add a short description for the connection failure test

Debug: sync health test

Since there's not currently any public facing docs on Sync settings
let's link the action to Github.
  • Loading branch information
roccotripaldi committed Mar 16, 2020
1 parent 94b829d commit 8a09d2d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
8 changes: 4 additions & 4 deletions _inc/lib/debugger/class-jetpack-cxn-test-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static function skipped_test( $args = array() ) {
* - pass: bool|string True if the test passed. Default false.
* - short_description: bool|string A brief, non-html description that will appear in CLI results, and as headings in admin UIs. Default 'Test failed!'.
* - long_description: bool|string An html description that will appear in the site health page. Default false.
* - severity: bool|string 'critical', 'recommended', or 'good'. Default: false.
* - severity: bool|string 'critical', 'recommended', or 'good'. Default: 'critical'.
* - action: bool|string A URL for the recommended action. Default: false.
* - action_label: bool|string The label for the recommended action. Default: false.
* - show_in_site_health: bool True if the test should be shown on the Site Health page. Default: true
Expand Down Expand Up @@ -429,9 +429,9 @@ public function output_results_for_core_async_site_health() {
}
} else {
$result['description'] .= sprintf(
'<p>%s</p>',
__( 'There was another problem:', 'jetpack' )
) . ' ' . $fail['message'] . ': ' . $fail['resolution'];
'<p>%s</p>',
__( 'There was another problem:', 'jetpack' )
) . ' ' . $fail['message'] . ': ' . $fail['resolution'];
if ( 'critical' === $fail['severity'] ) { // In case the initial failure is only "recommended".
$result['status'] = 'critical';
}
Expand Down
42 changes: 42 additions & 0 deletions _inc/lib/debugger/class-jetpack-cxn-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,48 @@ protected function test__server_port_value() {
}
}

/**
* If Sync is enabled, this test will be skipped. If Sync is disabled, the test will fail.
* Eventually, we'll make this test more robust with additional states. Here is the plan for possible Sync states,
* including states that are planned but not yet implemented.
*
* Enabled: Skips test
* Disabled: Results in a failing test
* Healthy: @todo
* In Progress: @todo
* Delayed: @todo
* Error: @todo
*/
protected function test__sync_health() {
$name = __FUNCTION__;
if ( ! $this->helper_is_jetpack_connected() ) {
// If the site is not connected, there is no point in testing Sync health.
return self::skipped_test( array( 'name' => $name, 'show_in_site_health' => false ) );
}
if ( Sync_Settings::is_sync_enabled() ) {
return self::skipped_test( array( 'name' => $name ) );
}
return self::failing_test( array(
'name' => $name,
'label' => __( 'Jetpack Sync has been disabled on your site.', 'jetpack' ),
'severity' => 'recommended',
'action' => 'https://github.com/Automattic/jetpack/blob/master/packages/sync/src/class-settings.php',
'action_label' => __( 'See Github for more on Sync Settings', 'jetpack' ),
'short_description' => __( 'Jetpack Sync has been disabled on your site.', 'jetpack' ),
'long_description' => sprintf(
'<p>%1$s</p>' .
'<p>%2$s</p>' .
'<p><span class="dashicons fail"><span class="screen-reader-text">%3$s</span></span> %4$s<strong> %5$s</strong></p>',
__( 'The information synced by Jetpack ensures that Jetpack Search, Related Posts and other features are aligned with your site’s current content.', 'jetpack' ),
__( 'Developers may enable / disable syncing using the Sync Settings API.', 'jetpack' ),
/* translators: screen reader text indicating a test failed */
__( 'Error', 'jetpack' ),
__( 'Jetpack Sync has been disabled on your site. Without it, certain Jetpack features will not work.', 'jetpack' ),
__( 'We recommend enabling Sync.', 'jetpack' )
)
) );
}

/**
* Calls to WP.com to run the connection diagnostic testing suite.
*
Expand Down
1 change: 0 additions & 1 deletion _inc/lib/debugger/debug-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,3 @@ function jetpack_debugger_site_status_tests( $core_tests ) {

return $core_tests;
}

0 comments on commit 8a09d2d

Please sign in to comment.