Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pwtyler committed Nov 12, 2024
1 parent 0e2b0fe commit 2e324de
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions .envrc.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export PANTHEON_INDEX_PORT=8983
export PANTHEON_INDEX_PATH=/solr
export PANTHEON_INDEX_CORE=${SOLR_CORE}
export PANTHEON_INDEX_SCHEME=http
export PANTHEON_INDEX_RELOAD_PATH=${SOLR_RELOAD_PATH}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
.idea
.DS_Store
docs/Badge.confluence

.envrc
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<server name="PANTHEON_INDEX_PATH" value="${PANTHEON_INDEX_PATH}" />
<server name="PANTHEON_INDEX_CORE" value="${PANTHEON_INDEX_CORE}" />
<server name="PANTHEON_INDEX_SCHEMA" value="${PANTHEON_INDEX_SCHEMA}" />
<server name="PANTHEON_INDEX_RELOAD_PATH" value="${PANTHEON_INDEX_RELOAD_PATH}" />
</php>
<testsuites>
<testsuite name="unit">
Expand Down
1 change: 1 addition & 0 deletions src/Plugin/SolrConnector/PantheonSolrConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public static function getPlatformConfig() {
'path' => getenv('PANTHEON_INDEX_PATH'),
'core' => getenv('PANTHEON_INDEX_CORE'),
'schema' => getenv('PANTHEON_INDEX_SCHEMA'),
'reload_path' => getenv('PANTHEON_INDEX_RELOAD_PATH')
];
}

Expand Down
14 changes: 12 additions & 2 deletions src/Services/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function getSchemaUploadUri(): string {
}

/**
* Get URL in pantheon environment to upload schema files.
* Get URL in pantheon environment to POST reload requests.
*
* @return string
* URL of envrionment.
Expand All @@ -209,11 +209,21 @@ public function getReloadUri(): string {
'%s/%s',
[
$this->getCoreBaseUri(),
'reload',
$this->getReloadPath(),
]
);
}

/**
* Get the path for Schema Reloads
*
* @return string
* The path for schema reloads
**/
public function getReloadPath(): string {
return $this->options['reload_path'];
}

/**
* Get the path for Schema Uploads.
*
Expand Down
13 changes: 13 additions & 0 deletions tests/Unit/EndpointServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function testURIGeneration() {
'schema' => '/schema-path',
'collection' => NULL,
'leader' => FALSE,
'reload_path' => "/reload-path",
]);

$this->assertEquals('/core-name', $ep->getCore());
Expand All @@ -43,6 +44,18 @@ public function testURIGeneration() {
'one://two:1234/server-path/schema-path',
$ep->getSchemaUploadUri()
);
$this->assertEquals(
'one://two:1234/server-path/schema-path',
$ep->getSchemaUploadUri()
);
$this->assertEquals(
'one://two:1234/server-path/schema-path/reload-path',
$ep->getReloadUri()
);
}

public function testReloadPath() {
$ep = new Endpoint(["reload_path"=>"/reload"]);
$this->assertEquals("/reload", $ep->getReloadPath());
}
}
4 changes: 3 additions & 1 deletion tests/Unit/GuzzleClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
* @package \Drupal\search_api_pantheon
*/
class GuzzleClassTest extends TestCase {


protected $loggerFactory;

/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit 2e324de

Please sign in to comment.