Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2015-03-09 05:45:21 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2015-03-09 05:45:44 +0300
commitb91058db45e645ea8ec4d28085238ca88733ef6c (patch)
treefa40797b8b32e77fae44bda385b9df49dda9b0d0 /plugins
parent157dea899a21d7f41593a55b43e54faee73985c4 (diff)
Added support for passing any number of arguments to the test command on AWS
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TestRunner/Commands/TestsRunOnAws.php11
-rw-r--r--plugins/TestRunner/Runner/Remote.php16
2 files changed, 15 insertions, 12 deletions
diff --git a/plugins/TestRunner/Commands/TestsRunOnAws.php b/plugins/TestRunner/Commands/TestsRunOnAws.php
index 8ff81fa0a5..65bce267e0 100644
--- a/plugins/TestRunner/Commands/TestsRunOnAws.php
+++ b/plugins/TestRunner/Commands/TestsRunOnAws.php
@@ -35,9 +35,10 @@ class TestsRunOnAws extends ConsoleCommand
{
$this->setName('tests:run-aws');
$this->addArgument('testsuite', InputArgument::OPTIONAL, 'Allowed values: ' . implode(', ', $this->allowedTestSuites));
+ $this->addArgument('arguments', InputArgument::IS_ARRAY, 'Any additional argument will be passed to the test command.');
$this->addOption('launch-only', null, InputOption::VALUE_NONE, 'Only launches an instance and outputs the connection parameters. Useful if you want to connect via SSH.');
$this->addOption('update-only', null, InputOption::VALUE_NONE, 'Launches an instance, outputs the connection parameters and prepares the instance for a test run but does not actually run the tests. It will also checkout the specified version.');
- $this->addOption('one-instance-per-testsuite', null, InputOption::VALUE_NONE, 'Launches an instance, outputs the connection parameters and prepares the instance for a test run but does not actually run the tests. It will also checkout the specified version.');
+ $this->addOption('one-instance-per-testsuite', null, InputOption::VALUE_NONE, 'Launches one instance for system tests and one for ui tests.');
$this->addOption('checkout', null, InputOption::VALUE_REQUIRED, 'Git hash, tag or branch to checkout. Defaults to current hash', $this->getCurrentGitHash());
$this->addOption('patch-file', null, InputOption::VALUE_REQUIRED, 'Apply the given patch file after performing a checkout');
$this->setDescription('Run a specific testsuite on AWS');
@@ -57,15 +58,15 @@ If you want to apply a patch on top of the checked out version you can apply the
<comment>./console tests:run-aws --patch-file=test.patch ui</comment>
This will checkout the same revision as you are currently on and then apply the patch. To generate a diff use for instance the command <comment>git diff > test.patch</comment>.
This feature is still beta and there might be problems with pictures and/or binaries etc.
+
+You can also pass any argument to the command and they will be forwarded to the test command, for example to run a specific UI test: <comment>./console tests:run-aws ui Dashboard</comment>.
');
}
- /**
- * Execute command like: ./console core:clear-caches
- */
protected function execute(InputInterface $input, OutputInterface $output)
{
$testSuite = $this->getTestSuite($input);
+ $arguments = $input->getArgument('arguments');
$patchFile = $this->getPatchFile($input);
$launchOnly = $input->getOption('launch-only');
$updateOnly = $input->getOption('update-only');
@@ -102,7 +103,7 @@ This feature is still beta and there might be problems with pictures and/or bina
return 0;
}
- $testRunner->runTests($host, $testSuite);
+ $testRunner->runTests($host, $testSuite, $arguments);
$message = $this->buildFinishedMessage($testSuite, $host);
$output->writeln("\n$message\n");
diff --git a/plugins/TestRunner/Runner/Remote.php b/plugins/TestRunner/Runner/Remote.php
index c0a5c5d8e1..d85c4a268a 100644
--- a/plugins/TestRunner/Runner/Remote.php
+++ b/plugins/TestRunner/Runner/Remote.php
@@ -55,11 +55,11 @@ class Remote
}
}
- public function runTests($host, $testSuite)
+ public function runTests($host, $testSuite, array $arguments)
{
$this->prepareTestRun($host);
$this->printVersionInfo();
- $this->doRunTests($testSuite);
+ $this->doRunTests($testSuite, $arguments);
}
private function prepareTestRun($host)
@@ -74,17 +74,19 @@ class Remote
$this->ssh->exec('phantomjs --version');
}
- private function doRunTests($testSuite)
+ private function doRunTests($testSuite, array $arguments)
{
+ $arguments = implode(' ', $arguments);
+
$this->ssh->exec("ps -ef | grep \"php console tests:run\" | grep -v grep | awk '{print $2}' | xargs kill -9");
if ('all' === $testSuite) {
- $this->ssh->exec('php console tests:run --options="--colors"');
+ $this->ssh->exec('php console tests:run --options="--colors" ' . $arguments);
} elseif ('ui' === $testSuite) {
- $this->ssh->exec('php console tests:run-ui --persist-fixture-data --assume-artifacts');
+ $this->ssh->exec('php console tests:run-ui --persist-fixture-data --assume-artifacts ' . $arguments);
} else {
- $this->ssh->exec('php console tests:run --options="--colors" --testsuite="unit"');
- $this->ssh->exec('php console tests:run --options="--colors" --testsuite="' . $testSuite . '"');
+ $this->ssh->exec('php console tests:run --options="--colors" --testsuite="unit" ' . $arguments);
+ $this->ssh->exec('php console tests:run --options="--colors" --testsuite="' . $testSuite . '" ' . $arguments);
}
if ('system' === $testSuite) {