forked from solariumphp/solarium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate from travis to github actions (solariumphp#792)
... and run all integration tests in cloud mode, too.
- Loading branch information
Markus Kalkbrenner
authored
May 29, 2020
1 parent
7b78901
commit 11bcd88
Showing
22 changed files
with
914 additions
and
922 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Run Tests | ||
|
||
on: | ||
push: | ||
|
||
schedule: | ||
- cron: '0 8 * * *' # run at 08:00 UTC | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php: [7.2, 7.3, 7.4] | ||
solr: [7, 8] | ||
mode: [cloud, server] | ||
symfony: [4.3.*, 4.4.*, 5.0.*] | ||
|
||
name: PHP ${{ matrix.php }}, symfony ${{ matrix.symfony }}, Solr ${{ matrix.solr }} ${{ matrix.mode }} | ||
|
||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, curl, libxml, mbstring, zip, intl, iconv, json, simplexml | ||
ini-values: memory_limit=256M,post_max_size=256M | ||
coverage: pcov | ||
|
||
- name: Checkout solarium | ||
uses: actions/checkout@v2 | ||
|
||
- name: Start Solr ${{ matrix.solr }} in ${{ matrix.mode }} mode | ||
run: | | ||
cd tests/Integration/Fixtures/docker/solr${{ matrix.solr }}_${{ matrix.mode }} | ||
docker-compose up -d | ||
- name: Install dependencies | ||
run: | | ||
composer global require hirak/prestissimo | ||
composer require --dev symfony/event-dispatcher:${{ matrix.symfony }} | ||
- name: Run tests | ||
env: | ||
COVERALLS_RUN_LOCALLY: 1 | ||
COVERALLS_REPO_TOKEN: | ||
run: | | ||
vendor/bin/phpstan analyze src/ tests/ --level=1 | ||
vendor/bin/phpunit -c phpunit.xml --exclude-group skip_for_solr_${{ matrix.mode }} -v | ||
vendor/bin/php-coveralls -v --dry-run |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
|
||
namespace Solarium\Tests\Integration; | ||
|
||
use Solarium\Core\Client\State\ClusterState; | ||
|
||
/** | ||
* Abstract base class. | ||
*/ | ||
abstract class AbstractCloudTest extends AbstractTechproductsTest | ||
{ | ||
|
||
protected static function createTechproducts(): void | ||
{ | ||
self::$config = [ | ||
'endpoint' => [ | ||
'localhost' => [ | ||
'host' => '127.0.0.1', | ||
'port' => 8983, | ||
'path' => '/', | ||
'collection' => self::$name, | ||
], | ||
], | ||
]; | ||
|
||
self::$client = TestClientFactory::createWithPsr18Adapter(self::$config); | ||
|
||
$collectionsQuery = self::$client->createCollections(); | ||
|
||
// create core with unique name using the techproducts configset | ||
$createAction = $collectionsQuery->createCreate(); | ||
$createAction->setName(self::$name) | ||
->setCollectionConfigName('techproducts') | ||
->setNumShards(2); | ||
$collectionsQuery->setAction($createAction); | ||
$response = self::$client->collections($collectionsQuery); | ||
static::assertTrue($response->getWasSuccessful()); | ||
} | ||
|
||
public static function tearDownAfterClass(): void | ||
{ | ||
$collectionsQuery = self::$client->createCollections(); | ||
|
||
// now we delete the collection we created in setUpBeforeClass() | ||
$deleteAction = $collectionsQuery->createDelete(); | ||
$deleteAction->setName(self::$name); | ||
$collectionsQuery->setAction($deleteAction); | ||
$response = self::$client->collections($collectionsQuery); | ||
static::assertTrue($response->getWasSuccessful()); | ||
} | ||
|
||
public function testCreateDelete() | ||
{ | ||
$collectionsQuery = self::$client->createCollections(); | ||
|
||
$action = $collectionsQuery->createCreate(); | ||
$action->setName('test'); | ||
$action->setNumShards(1); | ||
$collectionsQuery->setAction($action); | ||
$result = self::$client->collections($collectionsQuery); | ||
$this->assertTrue($result->getWasSuccessful()); | ||
|
||
$action = $collectionsQuery->createDelete(); | ||
$action->setName('test'); | ||
$collectionsQuery->setAction($action); | ||
$result = self::$client->collections($collectionsQuery); | ||
$this->assertTrue($result->getWasSuccessful()); | ||
} | ||
|
||
public function testReload() | ||
{ | ||
$collectionsQuery = self::$client->createCollections(); | ||
|
||
$action = $collectionsQuery->createReload(); | ||
$action->setName(self::$name); | ||
$collectionsQuery->setAction($action); | ||
$result = self::$client->collections($collectionsQuery); | ||
$this->assertTrue($result->getWasSuccessful()); | ||
} | ||
|
||
public function testClusterStatus() | ||
{ | ||
$collectionsQuery = self::$client->createCollections(); | ||
|
||
$action = $collectionsQuery->createClusterStatus(); | ||
$collectionsQuery->setAction($action); | ||
$result = self::$client->collections($collectionsQuery); | ||
$this->assertTrue($result->getWasSuccessful()); | ||
$clusterState = $result->getClusterState(); | ||
$this->assertSame(ClusterState::class, get_class($clusterState)); | ||
$this->assertCount(2, $clusterState->getLiveNodes()); | ||
$this->assertCount(1, $clusterState->getCollections()); | ||
$this->assertTrue($clusterState->collectionExists(self::$name)); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.