diff options
Diffstat (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php')
-rw-r--r-- | vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php index d70825d1..fbd2d297 100644 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/NodeTest.php @@ -1,14 +1,14 @@ <?php - namespace Elastica\Test; -use Elastica\Client; use Elastica\Node; use Elastica\Test\Base as BaseTest; class NodeTest extends BaseTest { - + /** + * @group functional + */ public function testCreateNode() { $client = $this->_getClient(); @@ -19,6 +19,9 @@ class NodeTest extends BaseTest $this->assertInstanceOf('Elastica\Node', $node); } + /** + * @group functional + */ public function testGetInfo() { $client = $this->_getClient(); @@ -32,6 +35,9 @@ class NodeTest extends BaseTest $this->assertInstanceOf('Elastica\Node\Info', $info); } + /** + * @group functional + */ public function testGetStats() { $client = $this->_getClient(); @@ -46,39 +52,24 @@ class NodeTest extends BaseTest } /** - * Shuts one of two nodes down (if two available) + * @group functional */ - public function testShutdown() + public function testGetName() { - $this->markTestSkipped('At least two nodes have to be running, because 1 node is shutdown'); - $client = $this->_getClient(); - $nodes = $client->getCluster()->getNodes(); + $nodes = $this->_getClient()->getCluster()->getNodes(); + // At least 1 instance must exist + $this->assertGreaterThan(0, $nodes); - $count = count($nodes); - if ($count < 2) { - $this->markTestSkipped('At least two nodes have to be running, because 1 node is shutdown'); + foreach ($nodes as $node) { + $this->assertEquals($node->getName(), 'Elastica'); } + } - // Store node info of node with port 9200 for later - foreach ($nodes as $key => $node) { - if ($node->getInfo()->getPort() == 9200) { - $info = $node->getInfo(); - unset($nodes[$key]); - } - } - - // Select one of the not port 9200 nodes and shut it down - $node = array_shift($nodes); - $node->shutdown('2s'); - - // Wait until node is shutdown - sleep(5); - - // Use still existing node - $client = new Client(array('host' => $info->getIp(), 'port' => $info->getPort())); - $names = $client->getCluster()->getNodeNames(); - - // One node less ... - $this->assertEquals($count - 1, count($names)); + /** + * @group functional + */ + public function testGetId() + { + $node = new Node('Elastica', $this->_getClient()); } } |