Skip to content

Commit

Permalink
Add a solr test (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall authored Jul 31, 2024
1 parent e781d40 commit 5390b35
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/init-template-starter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,21 @@ if [ ! -v ISLANDORA_TAG ] || [ "$ISLANDORA_TAG" = "" ]; then
ISLANDORA_TAG=main
fi

# save the site template default settings.php
# so we can overwrite it for the starter site
mv drupal/rootfs/var/www/drupal/assets/patches/default_settings.txt .

curl -L "https://github.com/Islandora-Devops/islandora-starter-site/archive/refs/${ISLANDORA_STARTER_REF}.tar.gz" \
| tar --strip-components=1 -C drupal/rootfs/var/www/drupal -xz

mv default_settings.txt drupal/rootfs/var/www/drupal/assets/patches/default_settings.txt

# copy any drush scripts into the rootfs so we can run them
cp ./tests/solr.php drupal/rootfs/var/www/drupal/

./generate-certs.sh
./generate-secrets.sh

docker compose --profile dev up -d

./tests/ping.sh

docker compose --profile dev exec drupal-dev drush scr solr.php
20 changes: 20 additions & 0 deletions tests/solr.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Drupal\search_api\Entity\Server;

$server_id = 'default_solr_server';
$server = Server::load($server_id);

if ($server) {
try {
$server->getBackend()->getSolrConnector()->pingServer();
echo "Solr server connection test passed.\n";
}
catch (Exception $e) {
echo "Solr server connection test failed: " . $e->getMessage() . "\n";
exit(1);
}
} else {
echo "Solr server not found.\n";
exit(1);
}

0 comments on commit 5390b35

Please sign in to comment.