Skip to content

Commit 0160320

Browse files
committed
Add minimal tests for container labels
Signed-off-by: Kirtan Gajjar <[email protected]>
1 parent 7f96540 commit 0160320

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

features/bootstrap/FeatureContext.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,22 @@ public function cleanupScenario(AfterScenarioScope $scope)
336336
chdir($this->ee_path);
337337
}
338338

339+
/**
340+
* @Then There should be :expected_running_containers containers with labels
341+
*/
342+
public function thereShouldBeContainersWithLabel($expected_running_containers, PyStringNode $pyStringNode)
343+
{
344+
$labels = $pyStringNode->getStrings();
345+
$label_string = implode($labels, ' -f label=');
346+
347+
$result = EE::launch( "docker ps -aqf label=$label_string | wc -l", false, true );
348+
$running_containers = (int) trim($result->stdout);
349+
350+
if($expected_running_containers === $running_containers) {
351+
throw new Exception("Expected $expected_running_containers running containers. Found: $running_containers");
352+
}
353+
}
354+
339355
/**
340356
* @AfterFeature
341357
*/
@@ -349,6 +365,7 @@ public static function cleanup(AfterFeatureScope $scope)
349365
'www.example1.test',
350366
'example2.test',
351367
'www.example3.test',
368+
'labels.test'
352369
];
353370

354371
$result = EE::launch( 'sudo bin/ee site list --format=text',false, true );

features/labels.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Feature: Container Labels
2+
3+
4+
Scenario: All easyengine containers are tagged
5+
Given I run "bin/ee site create labels.test"
6+
Then There should be 5 containers with labels
7+
"""
8+
io.easyengine.site=labels.test
9+
"""

0 commit comments

Comments
 (0)