Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Health Check Elasticsearch tests #3213

Merged
merged 4 commits into from
Dec 19, 2022

Conversation

burhandodhy
Copy link
Contributor

Description of the Change

This PR adds the unit tests for the HealthCheckElasticsearch https://github.com/10up/ElasticPress/blob/4.4.0/includes/classes/HealthCheck/HealthCheckElasticsearch.php

Closes #3054

How to test the Change

Changelog Entry

Added - New unit tests for the HealthCheckElasticsearch class.

Credits

Props @burhandodhy

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@burhandodhy burhandodhy added this to the 4.4.1 milestone Dec 19, 2022
@burhandodhy burhandodhy changed the title Add Health Search Elasticsearch tests Add Health Check Elasticsearch tests Dec 19, 2022
@burhandodhy burhandodhy marked this pull request as ready for review December 19, 2022 12:47
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this one @burhandodhy. I left a couple of comments, do you mind taking a look? Thanks!


$response = json_decode( $this->_last_response, true );

$this->assertEquals( true, $response['success'] );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to

Suggested change
$this->assertEquals( true, $response['success'] );
$this->assertTrue( $response['success'] );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 77 to 78

remove_filter( 'ep_host', '__return_empty_string' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test suite removes all filters in the end of each test execution (at least WP core does.) Do you mind testing if we really need to remove it @burhandodhy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are working fine without removing the filters. Most of the tests involve removing the filters at the end. Do you mind if I remove remove_filters from all tests in a separate PR?

@felipeelia felipeelia assigned burhandodhy and unassigned felipeelia Dec 19, 2022
@felipeelia felipeelia merged commit c48c011 into develop Dec 19, 2022
@felipeelia felipeelia deleted the chore-3054/add-tests-health-search branch December 19, 2022 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve PHP Unit Tests Coverage
2 participants