Skip to content

Commit

Permalink
NGSTACK-489: added dedicated services config for regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pspanja committed Mar 26, 2021
1 parent 0125436 commit af40a3c
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:
SOLR_CORES: ${{ matrix.solr_cores }}
if: matrix.solr_version
- run: |
sed -i.bak s/EzSystems\\\\EzPlatformSolrSearchEngine\\\\Tests\\\\SetupFactory\\\\LegacySetupFactory/Netgen\\\\EzPlatformSearchExtra\\\\Tests\\\\Integration\\\\SetupFactory\\\\Solr/g ${{ matrix.config }}
sed -i.bak s/EzSystems\\\\EzPlatformSolrSearchEngine\\\\Tests\\\\SetupFactory\\\\LegacySetupFactory/Netgen\\\\EzPlatformSearchExtra\\\\Tests\\\\Integration\\\\SetupFactory\\\\RegressionSolr/g ${{ matrix.config }}
sed -i.bak "s/eZ\/Publish\/API\/Repository\/Tests\/SearchServiceTest.php/..\/..\/..\/tests\/lib\/Kernel\/SearchServiceTest.php/g" ${{ matrix.config }}
sed -i.bak "s/eZ\/Publish\/API\/Repository\/Tests\/SearchServiceLocationTest.php/..\/..\/..\/tests\/lib\/Kernel\/SearchServiceLocationTest.php/g" ${{ matrix.config }}
if: matrix.regression
Expand Down
52 changes: 52 additions & 0 deletions tests/lib/Integration/Resources/config/regression_services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
services:
netgen_test.search.solr.subdocument_mapper.content:
class: Netgen\EzPlatformSearchExtra\Tests\Integration\Implementation\Solr\SubdocumentMapper\TestContentSubdocumentMapper
tags:
- {name: netgen.search.solr.subdocument_mapper.content}

netgen_test.search.solr.subdocument_mapper.content_translation:
class: Netgen\EzPlatformSearchExtra\Tests\Integration\Implementation\Solr\SubdocumentMapper\TestContentTranslationSubdocumentMapper
tags:
- {name: netgen.search.solr.subdocument_mapper.content_translation}

netgen_test.search.solr.subdocument_mapper.content.sort:
class: Netgen\EzPlatformSearchExtra\Tests\Integration\Implementation\Solr\SubdocumentMapper\TestSortContentSubdocumentMapper
tags:
- {name: netgen.search.solr.subdocument_mapper.content}

# netgen_test.search.solr.slot.subdocument_publish_version:
# parent: ezpublish.search.solr.slot
# class: '%ezpublish.search.solr.slot.publish_version.class%'
# tags:
# - {name: ezpublish.search.solr.slot, signal: ContentService\PublishVersionSignal}

netgen_test.search.solr.event_subscriber.child_updates_parent:
class: Netgen\EzPlatformSearchExtra\Tests\Integration\Implementation\Common\EventSubscriber\TestChildUpdatesParent
arguments:
- '@ezpublish.spi.search'
- '@ezpublish.api.persistence_handler'
tags:
- { name: kernel.event_subscriber }

# Disabled for regression tests
# Symfony\Component\EventDispatcher\EventDispatcher:
# calls:
# - ['addSubscriber', ['@netgen_test.search.solr.event_subscriber.child_updates_parent']]

netgen_test.search.solr.field_mapper.content:
class: Netgen\EzPlatformSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\TestContentFieldMapper
arguments:
- '@ezpublish.spi.persistence.content_handler'
- '@ezpublish.spi.persistence.content_type_handler'
- '@ezpublish.spi.search.legacy'
tags:
- { name: ezpublish.search.solr.field_mapper.content }

netgen_test.search.solr.field_mapper.location:
class: Netgen\EzPlatformSearchExtra\Tests\Integration\Implementation\Solr\FieldMapper\TestLocationFieldMapper
arguments:
- '@ezpublish.spi.persistence.content_handler'
- '@ezpublish.spi.persistence.content_type_handler'
- '@ezpublish.spi.search.legacy'
tags:
- { name: ezpublish.search.solr.field_mapper.location }
39 changes: 39 additions & 0 deletions tests/lib/Integration/SetupFactory/RegressionSolr.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace Netgen\EzPlatformSearchExtra\Tests\Integration\SetupFactory;

use EzSystems\EzPlatformSolrSearchEngine\Tests\SetupFactory\LegacySetupFactory as CoreSolrSetupFactory;
use Netgen\EzPlatformSearchExtra\Container\Compiler;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

class RegressionSolr extends CoreSolrSetupFactory
{
/**
* {@inheritdoc}
*
* @throws \Exception
*/
protected function externalBuildContainer(ContainerBuilder $containerBuilder)
{
parent::externalBuildContainer($containerBuilder);

$configPath = __DIR__ . '/../../../../lib/Resources/config/';
$loader = new YamlFileLoader($containerBuilder, new FileLocator($configPath));
$loader->load('search/common.yml');
$loader->load('search/solr.yml');

$testConfigPath = __DIR__ . '/../Resources/config/';
$loader = new YamlFileLoader($containerBuilder, new FileLocator($testConfigPath));
$loader->load('regression_services.yml');

// Needs to be added first because other passes depend on it
$containerBuilder->addCompilerPass(new Compiler\TagSubdocumentCriterionVisitorsPass());
$containerBuilder->addCompilerPass(new Compiler\AggregateContentSubdocumentMapperPass());
$containerBuilder->addCompilerPass(new Compiler\AggregateContentTranslationSubdocumentMapperPass());
$containerBuilder->addCompilerPass(new Compiler\AggregateSubdocumentQueryCriterionVisitorPass());
$containerBuilder->addCompilerPass(new Compiler\RawFacetBuilderDomainVisitorPass());
$containerBuilder->addCompilerPass(new Compiler\FieldTypeRegistryPass());
}
}

0 comments on commit af40a3c

Please sign in to comment.