mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-22 16:27:39 +01:00
Add oncePerNode() test
This commit is contained in:
parent
70733a42b7
commit
82c2b44561
25
tests/joy/OncePerNodeTest.php
Normal file
25
tests/joy/OncePerNodeTest.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/* (c) Anton Medvedev <anton@medv.io>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
class OncePerNodeTest extends AbstractTest
|
||||
{
|
||||
const RECIPE = __DIR__ . '/recipe/once_per_node.php';
|
||||
|
||||
public function testOnce()
|
||||
{
|
||||
$this->dep(self::RECIPE, 'test_once_per_node');
|
||||
|
||||
$display = $this->tester->getDisplay();
|
||||
self::assertEquals(0, $this->tester->getStatusCode(), $display);
|
||||
self::assertStringContainsString('alias: group_a_1 hostname: localhost', $display);
|
||||
self::assertStringNotContainsString('alias: group_a_2 hostname: localhost', $display);
|
||||
self::assertStringContainsString('alias: group_b_1 hostname: group_b_1', $display);
|
||||
self::assertStringNotContainsString('alias: group_b_2 hostname: group_b_2', $display);
|
||||
}
|
||||
}
|
16
tests/joy/recipe/once_per_node.php
Normal file
16
tests/joy/recipe/once_per_node.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Deployer;
|
||||
|
||||
localhost('group_a_1')
|
||||
->setHostname('localhost');
|
||||
localhost('group_a_2')
|
||||
->setHostname('localhost');
|
||||
localhost('group_b_1')
|
||||
->setLabels(['node' => 'anna']);
|
||||
localhost('group_b_2')
|
||||
->setLabels(['node' => 'anna']);
|
||||
|
||||
task('test_once_per_node', function () {
|
||||
writeln('alias: {{alias}} hostname: {{hostname}}');
|
||||
})->oncePerNode();
|
Loading…
x
Reference in New Issue
Block a user