mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
lnms dev:check add --os-modules-only option (#13700)
* lnms dev:check add --os-modules-only option And improve debug output * Style fixes * Add false flag
This commit is contained in:
@@ -72,6 +72,7 @@ class CiHelper
|
||||
'fail-fast' => false,
|
||||
'full' => false,
|
||||
'quiet' => false,
|
||||
'os-modules-only' => false,
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
@@ -183,13 +184,21 @@ class CiHelper
|
||||
array_push($phpunit_cmd, '--stop-on-error', '--stop-on-failure');
|
||||
}
|
||||
|
||||
if (Debug::isVerbose()) {
|
||||
$phpunit_cmd[] = '--debug';
|
||||
}
|
||||
|
||||
// exclusive tests
|
||||
if ($this->flags['unit_os']) {
|
||||
echo 'Only checking os: ' . implode(', ', $this->os) . PHP_EOL;
|
||||
$filter = implode('.*|', $this->os);
|
||||
// include tests that don't have data providers and only data sets that match
|
||||
array_push($phpunit_cmd, '--group', 'os');
|
||||
if ($this->flags['os-modules-only']) {
|
||||
array_push($phpunit_cmd, '--filter', "/::testOS with data set \"$filter.*\"$/");
|
||||
} else {
|
||||
array_push($phpunit_cmd, '--filter', "/::test[A-Za-z]+$|::testOSDetection|::test[A-Za-z]+ with data set \"$filter.*\"$/");
|
||||
}
|
||||
} elseif ($this->flags['unit_docs']) {
|
||||
array_push($phpunit_cmd, '--group', 'docs');
|
||||
} elseif ($this->flags['unit_svg']) {
|
||||
|
@@ -50,6 +50,7 @@ class DevCheckCommand extends LnmsCommand
|
||||
$this->addOption('db', null, InputOption::VALUE_NONE);
|
||||
$this->addOption('snmpsim', null, InputOption::VALUE_NONE);
|
||||
$this->addOption('full', null, InputOption::VALUE_NONE);
|
||||
$this->addOption('os-modules-only', null, InputOption::VALUE_NONE);
|
||||
$this->addOption('commands', 'c', InputOption::VALUE_NONE);
|
||||
}
|
||||
|
||||
@@ -90,7 +91,13 @@ class DevCheckCommand extends LnmsCommand
|
||||
$this->helper->enable('web', $check == 'ci' || $check === 'web');
|
||||
|
||||
if ($os = $this->option('os')) {
|
||||
$this->helper->setFlags(['style_enable' => false, 'lint_enable' => false, 'unit_enable' => true, 'web_enable' => false]);
|
||||
$this->helper->setFlags([
|
||||
'style_enable' => false,
|
||||
'lint_enable' => false,
|
||||
'unit_enable' => true,
|
||||
'web_enable' => false,
|
||||
'os-modules-only' => $this->option('os-modules-only'),
|
||||
]);
|
||||
$this->helper->setOS(explode(',', $os));
|
||||
}
|
||||
|
||||
|
@@ -45,6 +45,7 @@ return [
|
||||
'full' => 'Run full checks ignoring changed file filtering',
|
||||
'module' => 'Specific Module to run tests on. Implies unit, --db, --snmpsim',
|
||||
'os' => 'Specific OS to run tests on. Implies unit, --db, --snmpsim',
|
||||
'os-modules-only' => 'Skip os detection test when specifying a specific OS. Speeds up test time when checking non-detection changes.',
|
||||
'quiet' => 'Hide output unless there is an error',
|
||||
'snmpsim' => 'Use snmpsim for unit tests',
|
||||
],
|
||||
|
@@ -295,6 +295,7 @@ class CiHelperTest extends TestCase
|
||||
'fail-fast' => false,
|
||||
'full' => false,
|
||||
'quiet' => false,
|
||||
'os-modules-only' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user