Skip to content

Commit

Permalink
Fixes #1572: Failing Behat Test Hangs Pipelines Build.
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Jun 5, 2017
1 parent d4feab1 commit 3f3604f
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/Robo/Commands/Tests/BehatCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Acquia\Blt\Robo\Commands\Tests;

use Acquia\Blt\Robo\Exceptions\BltException;
use Acquia\Blt\Robo\Wizards\TestsWizard;
use Robo\Contract\VerbosityThresholdInterface;
use Symfony\Component\Console\Output\OutputInterface;
Expand Down Expand Up @@ -87,13 +88,20 @@ public function behat() {
$this->logConfig($this->getConfigValue('behat'), 'behat');
$this->logConfig($this->getInspector()->getLocalBehatConfig()->export());
$this->createReportsDir();
$this->launchWebServer();
$this->launchWebDriver();
$behat_exit_code = $this->executeBehatTests();
$this->killWebDriver();
$this->killWebServer();

return $behat_exit_code;
try {
$this->launchWebServer();
$this->launchWebDriver();
$this->executeBehatTests();
$this->killWebDriver();
$this->killWebServer();
}
catch (\Exception $e) {
// Kill web driver a server to prevent Pipelines from hanging after fail.
$this->killWebDriver();
$this->killWebServer();
throw $e;
}
}

/**
Expand Down Expand Up @@ -285,11 +293,9 @@ protected function executeBehatTests() {
$result = $task->run();

if (!$result->wasSuccessful()) {
return $result->getExitCode();
throw new BltException("Behat tests failed!");
}
}

return $exit_code;
}

}

0 comments on commit 3f3604f

Please sign in to comment.