Refactor integration tests to make requests to wordpress.org #421
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note
This PR is built on top of #415
The integration tests now make HTTP requests to api.wordpress.org instead of using cached content.
There are two kinds of tests:
action=query_plugins
, which returns a list of plugins (with a subset of properties).action=plugin_information
, which returns full plugin details.There are 44k plugins in wordpress.org. That means the first set of tests makes 250+ HTTP requests with 200 plugins per request, and the second set of tests makes 44k HTTP requests for each plugin.
I tried a few different ways to run those tests. I believe the one in this PR is the most optimal. To try it locally, run:
On CI,
./wordpress_org_api_integration_tests/replace-test-parameters.sh
makes requests to api.wordpress.org and generates test parameters (like 44k+ plugin slugs) for the integration tests. The integration tests are configured to load those parameters and generate individual test cases for them. That means there will be 250+ tests foraction=query_plugins
and 44k+ tests foraction=plugin_information
. Cargo runs them in parallel and reports their failures individually. They won't interfere with each other.When running locally during development, we don't need to run the shell script and can simply run
make test-rust-integration-wordpress-org-api
(orcargo test --package wordpress_org_api_integration_tests
) to run the integration tests. However, this will only run a few tests against api.wordpress.org. I don't see the need to run the full test suite locally, given the full test suite runs on CI regularly. If the CI job failed and we'd like to investigate, we can find the failed parameter (i.e. plugin slug) from CI job output, set it in thewordpress_org_api_integration_tests/tests/plugin_directory_parameters.rs
file, and run the tests locally to debug.