diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f5a29b6..6b03358 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,7 @@ jobs: matrix: operating-system: [ ubuntu-latest ] php: [ '8.1', '8.2' ] - symfony: ['5.3.*', '5.4.*', '6.0.*', '6.1.*', '6.2.*'] + symfony: ['6.3.*'] steps: - uses: actions/checkout@master diff --git a/composer.json b/composer.json index 6aa0716..7acd718 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,8 @@ ], "require": { "php": ">=8.1", - "symfony/framework-bundle": "^5.3|^6.0", - "symfony/serializer": "^5.3|^6.0" + "symfony/framework-bundle": "^6.3", + "symfony/serializer": "^6.3" }, "require-dev": { "nyholm/symfony-bundle-test": "^2.0", @@ -22,14 +22,14 @@ "whatwedo/php-coding-standard": "^1.0", "phpstan/phpstan": "^1.7", "phpunit/phpunit": "^9.5", - "symfony/browser-kit": "^5.3|^6.0", - "symfony/css-selector": "^5.3|^6.0", - "symfony/phpunit-bridge": "^6.2", + "symfony/browser-kit": "^6.3", + "symfony/css-selector": "^6.3", + "symfony/phpunit-bridge": "^6.3", "doctrine/doctrine-bundle": "^2.7", "doctrine/doctrine-migrations-bundle": "^3.2", "doctrine/orm": "^2.14", - "symfony/twig-bundle": "^5.3|^6.0", - "symfony/messenger": "^5.3|^6.0", + "symfony/twig-bundle": "^6.3", + "symfony/messenger": "^6.3", "symfony/mercure-bundle": "^0.3" }, "autoload": { diff --git a/phpstan.neon b/phpstan.neon index 328bcdb..f390efa 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,4 +4,4 @@ parameters: - src - tests bootstrapFiles: - - vendor/bin/.phpunit/phpunit-9.5-0/vendor/autoload.php + - vendor/bin/.phpunit/phpunit-9.6-0/vendor/autoload.php diff --git a/src/Command/CheckCommand.php b/src/Command/CheckCommand.php index ea8e164..8294b9f 100644 --- a/src/Command/CheckCommand.php +++ b/src/Command/CheckCommand.php @@ -20,6 +20,7 @@ class CheckCommand extends Command { public function __construct( + protected int $warningExitCode, protected MonitoringManager $monitoringManager ) { parent::__construct(); @@ -30,7 +31,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int $io = new SymfonyStyle($input, $output); $this->printResult($io, $this->monitoringManager->getResult()); - return $this->monitoringManager->isSuccessful() ? static::SUCCESS : static::FAILURE; + if ($this->monitoringManager->isSuccessful() && $this->monitoringManager->isWarning()) { + return $this->warningExitCode; + } elseif ($this->monitoringManager->isSuccessful()) { + return self::SUCCESS; + } + return self::FAILURE; } private function printResult(SymfonyStyle $io, $result, $previousGroup = null, $level = 0): void diff --git a/src/Controller/ApiController.php b/src/Controller/ApiController.php index 277e774..3b816a2 100644 --- a/src/Controller/ApiController.php +++ b/src/Controller/ApiController.php @@ -20,8 +20,8 @@ public function __construct( public function __invoke(Request $request, MonitoringManager $monitoringManager, SerializerInterface $serializer): Response { - if ($this->authToken !== null && - $request->headers->get('X-Auth-Token', '') !== $this->authToken) { + if ($this->authToken !== null + && $request->headers->get('X-Auth-Token', '') !== $this->authToken) { return new Response('Unauthorized', 401); } diff --git a/src/DependencyInjection/CompilerPass/AttributeCompilerPass.php b/src/DependencyInjection/CompilerPass/AttributeCompilerPass.php index ee18720..00cc92b 100644 --- a/src/DependencyInjection/CompilerPass/AttributeCompilerPass.php +++ b/src/DependencyInjection/CompilerPass/AttributeCompilerPass.php @@ -11,7 +11,7 @@ class AttributeCompilerPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { $definition = $container->getDefinition(MonitoringManager::class); diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 7682e49..3eec9e9 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -75,6 +75,10 @@ public function getConfigTreeBuilder(): TreeBuilder ->end() ->end() ->end() + ->integerNode('warning_exit_code') + ->defaultValue(1) + ->info('Exit code for warning state (default 1)') + ->end() ->end() ; diff --git a/src/DependencyInjection/whatwedoMonitorExtension.php b/src/DependencyInjection/whatwedoMonitorExtension.php index 75ec39d..256e3ac 100644 --- a/src/DependencyInjection/whatwedoMonitorExtension.php +++ b/src/DependencyInjection/whatwedoMonitorExtension.php @@ -4,7 +4,6 @@ namespace whatwedo\MonitorBundle\DependencyInjection; -use PHPUnit\Framework\MockObject\Api; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; @@ -23,12 +22,12 @@ */ class whatwedoMonitorExtension extends Extension implements PrependExtensionInterface { - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yaml'); // tag monitoring attributes (sensors and metrics) @@ -68,9 +67,15 @@ public function configureMonitoring(ContainerBuilder $container, array $config) $container->findDefinition(QueuedMessages::class) ->setArgument(0, $config['monitoring']['metric']['messenger']['queued_messages']['warning_threshold'] ?? 5) ->setArgument(1, $config['monitoring']['metric']['messenger']['queued_messages']['critical_threshold'] ?? 10); + if (!(isset($config['endpoint']['command']['enabled']) + && ! $config['endpoint']['command']['enabled'])) { + $container->findDefinition(CheckCommand::class) + ->setArgument(0, $config['warning_exit_code'] ?? 1) + ; + } } - public function prepend(ContainerBuilder $container) + public function prepend(ContainerBuilder $container): void { } } diff --git a/src/Manager/MonitoringManager.php b/src/Manager/MonitoringManager.php index 5abd217..1b6d9f5 100644 --- a/src/Manager/MonitoringManager.php +++ b/src/Manager/MonitoringManager.php @@ -7,7 +7,6 @@ use whatwedo\MonitorBundle\Enum\MetricStateEnum; use whatwedo\MonitorBundle\Enum\SensorStateEnum; use whatwedo\MonitorBundle\Monitoring\AttributeInterface; -use whatwedo\MonitorBundle\Monitoring\Metric\AbstractMetric; use whatwedo\MonitorBundle\Monitoring\Sensor\AbstractSensor; class MonitoringManager @@ -19,19 +18,24 @@ class MonitoringManager protected ?bool $isSuccessful = null; + protected ?bool $hasWarnings = null; + public function run(): void { $this->isSuccessful = true; + $this->hasWarnings = false; foreach ($this->attributes as $attribute) { if ($attribute->isEnabled()) { $attribute->run(); - if (($attribute instanceof AbstractSensor - && $attribute->getState() !== SensorStateEnum::SUCCESSFUL) - || ($attribute instanceof AbstractMetric - && $attribute->getState() !== MetricStateEnum::OK)) { + $wasSuccessful = $this->wasSuccessful($attribute); + $wasWarning = $this->wasWarning($attribute); + if (!$wasSuccessful && !$wasWarning) { $this->isSuccessful = false; } + if ($wasWarning) { + $this->hasWarnings = true; + } } } } @@ -81,6 +85,15 @@ public function isSuccessful(): bool return $this->isSuccessful; } + public function isWarning(): bool + { + if ($this->hasWarnings === null) { + $this->run(); + } + + return $this->hasWarnings; + } + public function addAttribute(AttributeInterface $attribute): void { $this->attributes[$attribute::class] = $attribute; @@ -90,4 +103,18 @@ public function getAttribute(string $className): AttributeInterface { return $this->attributes[$className]; } + + private function wasSuccessful(AttributeInterface $attribute): bool + { + return $attribute instanceof AbstractSensor + ? $attribute->getState() === SensorStateEnum::SUCCESSFUL + : $attribute->getState() === MetricStateEnum::OK; + } + + private function wasWarning(AttributeInterface $abstract): bool + { + return $abstract instanceof AbstractSensor + ? $abstract->getState() === SensorStateEnum::WARNING + : $abstract->getState() === MetricStateEnum::WARNING; + } } diff --git a/src/Monitoring/Metric/AbstractMetric.php b/src/Monitoring/Metric/AbstractMetric.php index f7a3ff8..4b8059a 100644 --- a/src/Monitoring/Metric/AbstractMetric.php +++ b/src/Monitoring/Metric/AbstractMetric.php @@ -16,7 +16,7 @@ abstract class AbstractMetric implements AttributeInterface public function getState(): MetricStateEnum { if ($this->state === null) { - throw new \RuntimeException(__CLASS__ . '::$state is not set.'); + throw new \RuntimeException(__CLASS__.'::$state is not set.'); } return $this->state; diff --git a/src/Monitoring/Sensor/AbstractSensor.php b/src/Monitoring/Sensor/AbstractSensor.php index cf99b1d..dab6082 100644 --- a/src/Monitoring/Sensor/AbstractSensor.php +++ b/src/Monitoring/Sensor/AbstractSensor.php @@ -16,7 +16,7 @@ abstract class AbstractSensor implements AttributeInterface public function getState(): SensorStateEnum { if ($this->state === null) { - throw new \RuntimeException(__CLASS__ . '::$state is not set.'); + throw new \RuntimeException(__CLASS__.'::$state is not set.'); } return $this->state; diff --git a/src/Monitoring/Sensor/Database/DoctrineDbal.php b/src/Monitoring/Sensor/Database/DoctrineDbal.php index 2f75ee5..78c494d 100644 --- a/src/Monitoring/Sensor/Database/DoctrineDbal.php +++ b/src/Monitoring/Sensor/Database/DoctrineDbal.php @@ -52,7 +52,7 @@ public function run(): void public static function getSubscribedServices(): array { return [ - '?' . ManagerRegistry::class, + '?'.ManagerRegistry::class, ]; } } diff --git a/src/Normalizer/AttributeNormalizer.php b/src/Normalizer/AttributeNormalizer.php index 44ce132..4ee8904 100644 --- a/src/Normalizer/AttributeNormalizer.php +++ b/src/Normalizer/AttributeNormalizer.php @@ -10,7 +10,7 @@ use whatwedo\MonitorBundle\Monitoring\Metric\AbstractMetric; use whatwedo\MonitorBundle\Monitoring\Sensor\AbstractSensor; -class AttributeNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface +class AttributeNormalizer implements NormalizerInterface { /** * @param AttributeInterface $object @@ -39,8 +39,10 @@ public function supportsNormalization($data, string $format = null, array $conte return $data instanceof AttributeInterface; } - public function hasCacheableSupportsMethod(): bool + public function getSupportedTypes(?string $format): array { - return true; + return [ + AttributeInterface::class => true, + ]; } } diff --git a/src/Normalizer/EnumNormalizer.php b/src/Normalizer/EnumNormalizer.php index 27c8476..da0c79f 100644 --- a/src/Normalizer/EnumNormalizer.php +++ b/src/Normalizer/EnumNormalizer.php @@ -4,15 +4,11 @@ namespace whatwedo\MonitorBundle\Normalizer; -use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use whatwedo\MonitorBundle\Enum\MetricStateEnum; use whatwedo\MonitorBundle\Enum\SensorStateEnum; -/** - * symfony 5.3 compatibility (https://github.com/symfony/symfony/pull/40830 has been merged into 5.4) - */ -class EnumNormalizer implements NormalizerInterface, CacheableSupportsMethodInterface +class EnumNormalizer implements NormalizerInterface { /** * @param MetricStateEnum|SensorStateEnum $object @@ -24,12 +20,14 @@ public function normalize($object, string $format = null, array $context = []): public function supportsNormalization($data, string $format = null, array $context = []): bool { - return ! class_exists('Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer') - && ($data instanceof MetricStateEnum || $data instanceof SensorStateEnum); + return $data instanceof MetricStateEnum || $data instanceof SensorStateEnum; } - public function hasCacheableSupportsMethod(): bool + public function getSupportedTypes(?string $format): array { - return true; + return [ + MetricStateEnum::class => true, + SensorStateEnum::class => true, + ]; } } diff --git a/src/whatwedoMonitorBundle.php b/src/whatwedoMonitorBundle.php index be82a8b..4c21605 100644 --- a/src/whatwedoMonitorBundle.php +++ b/src/whatwedoMonitorBundle.php @@ -10,7 +10,7 @@ class whatwedoMonitorBundle extends Bundle { - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { parent::build($container); diff --git a/tests/BundleInitializationTest.php b/tests/BundleInitializationTest.php index 1169dad..22369fd 100644 --- a/tests/BundleInitializationTest.php +++ b/tests/BundleInitializationTest.php @@ -27,7 +27,7 @@ public function testDisabledApi(): void { $kernel = self::bootKernel([ 'config' => static function (TestKernel $kernel) { - $kernel->addTestConfig(__DIR__ . '/config/disabled_api.yml'); + $kernel->addTestConfig(__DIR__.'/config/disabled_api.yml'); }, ]); @@ -38,7 +38,7 @@ public function testDisabledController(): void { $kernel = self::bootKernel([ 'config' => static function (TestKernel $kernel) { - $kernel->addTestConfig(__DIR__ . '/config/disabled_controller.yml'); + $kernel->addTestConfig(__DIR__.'/config/disabled_controller.yml'); }, ]); @@ -49,7 +49,7 @@ public function testDisabledCommand(): void { $kernel = self::bootKernel([ 'config' => static function (TestKernel $kernel) { - $kernel->addTestConfig(__DIR__ . '/config/disabled_command.yml'); + $kernel->addTestConfig(__DIR__.'/config/disabled_command.yml'); }, ]); diff --git a/tests/Command/CheckCommandTest.php b/tests/Command/CheckCommandTest.php index 6f61025..8a418bf 100644 --- a/tests/Command/CheckCommandTest.php +++ b/tests/Command/CheckCommandTest.php @@ -18,7 +18,7 @@ public function testSuccessful(): void { $kernel = self::bootKernel([ 'config' => static function (TestKernel $kernel) { - $kernel->addTestConfig(__DIR__ . '/../config/dummy_successful.yml'); + $kernel->addTestConfig(__DIR__.'/../config/dummy_successful.yml'); }, ]); @@ -29,4 +29,36 @@ public function testSuccessful(): void $commandTester->execute([]); self::assertEquals(0, $commandTester->getStatusCode()); } + + public function testWarning(): void + { + $kernel = self::bootKernel([ + 'config' => static function (TestKernel $kernel) { + $kernel->addTestConfig(__DIR__.'/../config/dummy_warning.yml'); + }, + ]); + + $application = new Application($kernel); + $command = $application->find('whatwedo:monitor:check'); + + $commandTester = new CommandTester($command); + $commandTester->execute([]); + self::assertEquals(1, $commandTester->getStatusCode()); + } + + public function testWarningCustomExitCode(): void + { + $kernel = self::bootKernel([ + 'config' => static function (TestKernel $kernel) { + $kernel->addTestConfig(__DIR__.'/../config/dummy_warning_custom_exit_code.yml'); + }, + ]); + + $application = new Application($kernel); + $command = $application->find('whatwedo:monitor:check'); + + $commandTester = new CommandTester($command); + $commandTester->execute([]); + self::assertEquals(2, $commandTester->getStatusCode()); + } } diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 1ba8bfb..dccd93d 100644 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -19,7 +19,7 @@ public function testApiJson(): void $client = $this->getClient($this->getApiKernel()); $client->request('GET', '/api.json'); $this->assertEquals(503, $client->getResponse()->getStatusCode()); - $this->assertJsonStringEqualsJsonFile(__DIR__ . '/responses/result.json', $client->getResponse()->getContent()); + $this->assertJsonStringEqualsJsonFile(__DIR__.'/responses/result.json', $client->getResponse()->getContent()); } public function testApiJsonPretty(): void @@ -27,7 +27,7 @@ public function testApiJsonPretty(): void $client = $this->getClient($this->getApiKernel()); $client->request('GET', '/api.json?pretty'); $this->assertEquals(503, $client->getResponse()->getStatusCode()); - $this->assertJsonStringEqualsJsonFile(__DIR__ . '/responses/result_pretty.json', $client->getResponse()->getContent()); + $this->assertJsonStringEqualsJsonFile(__DIR__.'/responses/result_pretty.json', $client->getResponse()->getContent()); } public function testApiXml(): void @@ -35,7 +35,7 @@ public function testApiXml(): void $client = $this->getClient($this->getApiKernel()); $client->request('GET', '/api.xml'); $this->assertEquals(503, $client->getResponse()->getStatusCode()); - $this->assertXmlStringEqualsXmlFile(__DIR__ . '/responses/result.xml', $client->getResponse()->getContent()); + $this->assertXmlStringEqualsXmlFile(__DIR__.'/responses/result.xml', $client->getResponse()->getContent()); } public function testApiProtectedSuccessful(): void @@ -67,8 +67,8 @@ protected function getApiKernel(): KernelInterface { return self::bootKernel([ 'config' => static function (TestKernel $kernel) { - $kernel->addTestConfig(__DIR__ . '/../config/dummy.yml'); - $kernel->addTestRoutingFile(__DIR__ . '/config/routes.yml'); + $kernel->addTestConfig(__DIR__.'/../config/dummy.yml'); + $kernel->addTestRoutingFile(__DIR__.'/config/routes.yml'); }, ]); } @@ -77,8 +77,8 @@ protected function getProtectedApiKernel(): KernelInterface { return self::bootKernel([ 'config' => static function (TestKernel $kernel) { - $kernel->addTestRoutingFile(__DIR__ . '/config/routes.yml'); - $kernel->addTestConfig(__DIR__ . '/config/protected_api.yml'); + $kernel->addTestRoutingFile(__DIR__.'/config/routes.yml'); + $kernel->addTestConfig(__DIR__.'/config/protected_api.yml'); }, ]); } diff --git a/tests/Controller/DashboardControllerTest.php b/tests/Controller/DashboardControllerTest.php index a011d2d..626a4ff 100644 --- a/tests/Controller/DashboardControllerTest.php +++ b/tests/Controller/DashboardControllerTest.php @@ -36,8 +36,8 @@ protected function getApiKernel(): KernelInterface { return self::bootKernel([ 'config' => static function (TestKernel $kernel) { - $kernel->addTestRoutingFile(__DIR__ . '/config/routes.yml'); - $kernel->addTestConfig(__DIR__ . '/../config/dummy.yml'); + $kernel->addTestRoutingFile(__DIR__.'/config/routes.yml'); + $kernel->addTestConfig(__DIR__.'/../config/dummy.yml'); $kernel->addTestBundle(TwigBundle::class); }, ]); diff --git a/tests/Monitoring/Sensor/Database/DoctrineDbalTest.php b/tests/Monitoring/Sensor/Database/DoctrineDbalTest.php index 0bc73ee..55f0609 100644 --- a/tests/Monitoring/Sensor/Database/DoctrineDbalTest.php +++ b/tests/Monitoring/Sensor/Database/DoctrineDbalTest.php @@ -17,13 +17,13 @@ class DoctrineDbalTest extends AbstractMonitoringTest public static function configureSuccessfulKernel(TestKernel $kernel): void { $kernel->addTestBundle(DoctrineBundle::class); - $kernel->addTestConfig(__DIR__ . '/config/doctrine_dbal_successful.yml'); + $kernel->addTestConfig(__DIR__.'/config/doctrine_dbal_successful.yml'); } public static function configureFailureKernel(TestKernel $kernel): void { $kernel->addTestBundle(DoctrineBundle::class); - $kernel->addTestConfig(__DIR__ . '/config/doctrine_dbal_error.yml'); + $kernel->addTestConfig(__DIR__.'/config/doctrine_dbal_error.yml'); } protected function getMonitoringClass(): string diff --git a/tests/Monitoring/Sensor/Database/DoctrineMigrationsTest.php b/tests/Monitoring/Sensor/Database/DoctrineMigrationsTest.php index 80726a8..699816f 100644 --- a/tests/Monitoring/Sensor/Database/DoctrineMigrationsTest.php +++ b/tests/Monitoring/Sensor/Database/DoctrineMigrationsTest.php @@ -54,16 +54,16 @@ public static function configureSuccessfulKernel(TestKernel $kernel): void { $kernel->addTestBundle(DoctrineBundle::class); $kernel->addTestBundle(DoctrineMigrationsBundle::class); - $kernel->addTestConfig(__DIR__ . '/config/doctrine_dbal_successful.yml'); - $kernel->addTestConfig(__DIR__ . '/config/doctrine_migrations.yml'); + $kernel->addTestConfig(__DIR__.'/config/doctrine_dbal_successful.yml'); + $kernel->addTestConfig(__DIR__.'/config/doctrine_migrations.yml'); } public static function configureFailureKernel(TestKernel $kernel): void { $kernel->addTestBundle(DoctrineBundle::class); $kernel->addTestBundle(DoctrineMigrationsBundle::class); - $kernel->addTestConfig(__DIR__ . '/config/doctrine_dbal_successful.yml'); - $kernel->addTestConfig(__DIR__ . '/config/doctrine_migrations.yml'); + $kernel->addTestConfig(__DIR__.'/config/doctrine_dbal_successful.yml'); + $kernel->addTestConfig(__DIR__.'/config/doctrine_migrations.yml'); } protected function getMonitoringClass(): string diff --git a/tests/Monitoring/Sensor/Service/MercureTest.php b/tests/Monitoring/Sensor/Service/MercureTest.php index f4dbd21..7eb8366 100644 --- a/tests/Monitoring/Sensor/Service/MercureTest.php +++ b/tests/Monitoring/Sensor/Service/MercureTest.php @@ -41,7 +41,7 @@ public function testFailure(): void public static function configureSuccessfulKernel(TestKernel $kernel): void { $kernel->addTestBundle(MercureBundle::class); - $kernel->addTestConfig(__DIR__ . '/config/mercure.yml'); + $kernel->addTestConfig(__DIR__.'/config/mercure.yml'); } protected function getHub(): MockObject&HubInterface diff --git a/tests/UseTestKernelTrait.php b/tests/UseTestKernelTrait.php index 715c56d..9af062c 100644 --- a/tests/UseTestKernelTrait.php +++ b/tests/UseTestKernelTrait.php @@ -15,7 +15,7 @@ protected static function createKernel(array $options = []): KernelInterface /** @var TestKernel $kernel */ $kernel = parent::createKernel($options); $kernel->addTestBundle(whatwedoMonitorBundle::class); - $kernel->addTestConfig(__DIR__ . '/config/framework.yml'); + $kernel->addTestConfig(__DIR__.'/config/framework.yml'); $kernel->handleOptions($options); return $kernel; diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 59bf713..904fd98 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -4,6 +4,6 @@ use Symfony\Component\Filesystem\Filesystem; -require \dirname(__DIR__) . '/vendor/autoload.php'; +require \dirname(__DIR__).'/vendor/autoload.php'; -(new Filesystem())->remove(__DIR__ . '/../var'); +(new Filesystem())->remove(__DIR__.'/../var'); diff --git a/tests/config/dummy_warning.yml b/tests/config/dummy_warning.yml new file mode 100644 index 0000000..34f3c99 --- /dev/null +++ b/tests/config/dummy_warning.yml @@ -0,0 +1,6 @@ +services: + whatwedo\MonitorBundle\Tests\Monitoring\Sensor\Dummy\WarningDummySensor: + tags: [ 'whatwedo_monitor.attribute' ] + + whatwedo\MonitorBundle\Tests\Monitoring\Metric\Dummy\WarningDummyMetric: + tags: [ 'whatwedo_monitor.attribute' ] diff --git a/tests/config/dummy_warning_custom_exit_code.yml b/tests/config/dummy_warning_custom_exit_code.yml new file mode 100644 index 0000000..af12e0c --- /dev/null +++ b/tests/config/dummy_warning_custom_exit_code.yml @@ -0,0 +1,9 @@ +services: + whatwedo\MonitorBundle\Tests\Monitoring\Sensor\Dummy\WarningDummySensor: + tags: [ 'whatwedo_monitor.attribute' ] + + whatwedo\MonitorBundle\Tests\Monitoring\Metric\Dummy\WarningDummyMetric: + tags: [ 'whatwedo_monitor.attribute' ] + +whatwedo_monitor: + warning_exit_code: 2