Skip to content

CLI-1761: Implement createSolrCore command for MEO environments.#1984

Closed
deepakmishra2 wants to merge 6 commits intomainfrom
CLI-1761
Closed

CLI-1761: Implement createSolrCore command for MEO environments.#1984
deepakmishra2 wants to merge 6 commits intomainfrom
CLI-1761

Conversation

@deepakmishra2
Copy link
Copy Markdown
Contributor

Motivation

Fixes #CLI-1761

Proposed changes

This pull request adds support for creating Solr search indexes within a specific environment via the API, and introduces corresponding automated tests to ensure the new functionality works as expected.

API enhancements:

  • Added a new POST /v3/environments/{environmentId}/search/indexes endpoint to the OpenAPI spec, allowing provisioning of a new Solr core (search index) for a given environment. The endpoint requires indexName and configsetUuid in the request body, and supports both JSON and form-encoded input.

Testing improvements:

  • Added a PHPUnit test testMeoEnvironmentSearchIndexCreate in ApiCommandTest.php to verify the new search index creation command, including request arguments, response handling, and output validation.

Testing steps
acli api:environments-v3:search:index-create

Copilot AI review requested due to automatic review settings April 15, 2026 09:44
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.37%. Comparing base (c864c3f) to head (5107dfb).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1984   +/-   ##
=========================================
  Coverage     92.37%   92.37%           
  Complexity     1953     1953           
=========================================
  Files           123      123           
  Lines          7081     7081           
=========================================
  Hits           6541     6541           
  Misses          540      540           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown

Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/1984/acli.phar

curl -OL https://acquia-cli.s3.amazonaws.com/build/pr/1984/acli.phar
chmod +x acli.phar

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Acquia Cloud API v3 environment endpoint and corresponding CLI command/test to provision (create) a Solr search index (core) for MEO environments.

Changes:

  • Added POST /v3/environments/{environmentId}/search/indexes to the embedded OpenAPI spec with CLI mapping environments-v3:search:index-create.
  • Added a PHPUnit test covering request construction, invocation, and output for api:environments-v3:search:index-create.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
tests/phpunit/src/Commands/Api/ApiCommandTest.php Adds an execution test for the new api:environments-v3:search:index-create command.
assets/acquia-spec.json Introduces the new v3 environments search index create endpoint definition used for command generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread assets/acquia-spec.json Outdated
Comment thread assets/acquia-spec.json Outdated
Comment thread assets/acquia-spec.json Outdated
Comment thread assets/acquia-spec.json Outdated
Comment thread assets/acquia-spec.json Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread assets/acquia-spec.json Outdated
Comment thread assets/acquia-spec.json Outdated
Comment on lines +44267 to +44293
"requestBody": {
"required": true,
"content": {
"application/hal+json": {
"schema": {
"type": "object",
"required": [
"config_set_id",
"database_role"
],
"properties": {
"config_set_id": {
"type": "string",
"description": "The identifier of the Solr configuration set to be used."
},
"database_role": {
"type": "string",
"description": "The database role for the new Solr core."
}
}
},
"example": {
"config_set_id": "DHJX-211844.9bb9b2f2c26be19cadf4057b95ad5ad6",
"database_role": "example"
}
},
"application/x-www-form-urlencoded": {
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The requestBody is described (in PR text) as supporting JSON input, but the spec only declares application/hal+json and application/x-www-form-urlencoded. Since the CLI sends post params via the HTTP client's json option, consider adding an application/json entry (same schema/example) so the OpenAPI accurately reflects supported content-types and client generators/tests can select JSON explicitly.

Copilot uses AI. Check for mistakes.
Comment thread assets/acquia-spec.json Outdated
Comment on lines +44327 to +44334
"message": "The search index for example is being created.",
"_links": {
"self": {
"href": "https://cloud.acquia.com/api/environments/3e8ecbec-ea7c-4260-8414-ef2938c859bc/search/indexes/ABCDE-1234.test.example"
},
"parent": {
"href": "https://cloud.acquia.com/api/environments/3e8ecbec-ea7c-4260-8414-ef2938c859bc/search/indexes/"
},
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The 202 response example _links point at /api/environments/.../search/indexes..., but this operation path is /translation/environments/.../search/indexes. If /translation is the canonical resource path for this API, update the example link URLs to match to avoid misleading consumers (or clarify why the links intentionally omit /translation).

Copilot uses AI. Check for mistakes.
Comment on lines +427 to +440
$mockRequestArgs = self::getMockRequestBodyFromSpec('/translation/environments/{environmentId}/search/indexes');
$mockResponseBody = self::getMockResponseFromSpec('/translation/environments/{environmentId}/search/indexes', 'post', '202');
foreach ($mockRequestArgs as $name => $value) {
$this->clientProphecy->addOption('json', [$name => $value])
->shouldBeCalled();
}
$this->clientProphecy->request('post', '/translation/environments/' . $environmentId . '/search/indexes')
->willReturn($mockResponseBody)
->shouldBeCalled();
$this->command = $this->getApiCommandByName('api:environments-v3:search:index-create');
$this->executeCommand(array_merge(
['environmentId' => $environmentId],
$mockRequestArgs,
));
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The generated CLI arguments for this endpoint will be config_set_id and database_role (from the requestBody schema/example). That doesn’t match the PR description/testing steps which refer to indexName and configsetUuid. Either update the PR description/testing steps to match the actual CLI interface, or adjust the spec field names/CLI mapping so the command accepts the intended argument names.

Copilot uses AI. Check for mistakes.
@deepakmishra2
Copy link
Copy Markdown
Contributor Author

Closing this as the approach is changed to add the spec in secret and then merge it in CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants