From 80f7dc77d430774192b929d780f96260066df2ee Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 18 Oct 2015 09:31:31 +0200 Subject: Update to MediaWiki 1.25.3 --- .../test/lib/Elastica/Test/Index/SettingsTest.php | 300 --------------------- .../test/lib/Elastica/Test/Index/StatsTest.php | 23 -- .../test/lib/Elastica/Test/Index/StatusTest.php | 66 ----- 3 files changed, 389 deletions(-) delete mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Index/SettingsTest.php delete mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatsTest.php delete mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Index') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/SettingsTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/SettingsTest.php deleted file mode 100644 index 4f74d22b..00000000 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/SettingsTest.php +++ /dev/null @@ -1,300 +0,0 @@ -_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - $index->refresh(); - $settings = $index->getSettings(); - - $this->assertInternalType('array', $settings->get()); - $this->assertNotNull($settings->get('number_of_replicas')); - $this->assertNotNull($settings->get('number_of_shards')); - $this->assertNull($settings->get('kjqwerjlqwer')); - - $index->delete(); - } - - public function testGetWithAlias() - { - $indexName = 'elasticatest'; - $aliasName = 'elasticatest_alias'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - $index->refresh(); - - $index->addAlias($aliasName); - $index = $client->getIndex($aliasName); - $settings = $index->getSettings(); - - $this->assertInternalType('array', $settings->get()); - $this->assertNotNull($settings->get('number_of_replicas')); - $this->assertNotNull($settings->get('number_of_shards')); - $this->assertNull($settings->get('kjqwerjlqwer')); - - $index->delete(); - } - - public function testSetNumberOfReplicas() - { - $indexName = 'test'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - $settings = $index->getSettings(); - - $settings->setNumberOfReplicas(2); - $index->refresh(); - $this->assertEquals(2, $settings->get('number_of_replicas')); - - $settings->setNumberOfReplicas(3); - $index->refresh(); - $this->assertEquals(3, $settings->get('number_of_replicas')); - - $index->delete(); - } - - public function testSetRefreshInterval() - { - $indexName = 'test'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - - $settings = $index->getSettings(); - - $settings->setRefreshInterval('2s'); - $index->refresh(); - $this->assertEquals('2s', $settings->get('refresh_interval')); - - $settings->setRefreshInterval('5s'); - $index->refresh(); - $this->assertEquals('5s', $settings->get('refresh_interval')); - - $index->delete(); - } - - public function testGetRefreshInterval() - { - $indexName = 'test'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - - $settings = $index->getSettings(); - - $this->assertEquals(IndexSettings::DEFAULT_REFRESH_INTERVAL, $settings->getRefreshInterval()); - - $interval = '2s'; - $settings->setRefreshInterval($interval); - $index->refresh(); - $this->assertEquals($interval, $settings->getRefreshInterval()); - $this->assertEquals($interval, $settings->get('refresh_interval')); - - $index->delete(); - } - - public function testSetMergePolicy() - { - $indexName = 'test'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - //wait for the shards to be allocated - $this->_waitForAllocation($index); - - $settings = $index->getSettings(); - - $settings->setMergePolicy('expunge_deletes_allowed', 15); - $this->assertEquals(15, $settings->getMergePolicy('expunge_deletes_allowed')); - - $settings->setMergePolicy('expunge_deletes_allowed', 10); - $this->assertEquals(10, $settings->getMergePolicy('expunge_deletes_allowed')); - - $index->delete(); - } - - public function testSetMergeFactor() - { - $indexName = 'test'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - - //wait for the shards to be allocated - $this->_waitForAllocation($index); - - $settings = $index->getSettings(); - - $response = $settings->setMergePolicy('merge_factor', 15); - $this->assertEquals(15, $settings->getMergePolicy('merge_factor')); - $this->assertInstanceOf('Elastica\Response', $response); - $this->assertTrue($response->isOk()); - - $settings->setMergePolicy('merge_factor', 10); - $this->assertEquals(10, $settings->getMergePolicy('merge_factor')); - - $index->delete(); - } - - public function testSetMergePolicyType() - { - $indexName = 'test'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - - //wait for the shards to be allocated - $this->_waitForAllocation($index); - - $settings = $index->getSettings(); - - $settings->setMergePolicyType('log_byte_size'); - $this->assertEquals('log_byte_size', $settings->getMergePolicyType()); - - $response = $settings->setMergePolicy('merge_factor', 15); - $this->assertEquals(15, $settings->getMergePolicy('merge_factor')); - $this->assertInstanceOf('Elastica\Response', $response); - $this->assertTrue($response->isOk()); - - $index->delete(); - } - - public function testSetReadOnly() - { - $index = $this->_createIndex('test'); - //wait for the shards to be allocated - $this->_waitForAllocation($index); - $index->getSettings()->setReadOnly(false); - - - // Add document to normal index - $doc1 = new Document(null, array('hello' => 'world')); - $doc2 = new Document(null, array('hello' => 'world')); - $doc3 = new Document(null, array('hello' => 'world')); - - $type = $index->getType('test'); - $type->addDocument($doc1); - $this->assertEquals('false', $index->getSettings()->get('blocks.read_only')); //ES returns a string for this setting - - // Try to add doc to read only index - $index->getSettings()->setReadOnly(true); - $this->assertEquals('true', $index->getSettings()->get('blocks.read_only')); - - try { - $type->addDocument($doc2); - $this->fail('Should throw exception because of read only'); - } catch (ResponseException $e) { - $message = $e->getMessage(); - $this->assertContains('ClusterBlockException', $message); - $this->assertContains('index read-only', $message); - } - - // Remove read only, add document - $response = $index->getSettings()->setReadOnly(false); - $this->assertTrue($response->isOk()); - - $type->addDocument($doc3); - $index->refresh(); - - $this->assertEquals(2, $type->count()); - - $index->delete(); - } - - - public function testGetSetBlocksRead() - { - $index = $this->_createIndex('elastica-test'); - $index->refresh(); - $settings = $index->getSettings(); - - $this->assertFalse($settings->getBlocksRead()); - - $settings->setBlocksRead(true); - $this->assertTrue($settings->getBlocksRead()); - - $settings->setBlocksRead(false); - $this->assertFalse($settings->getBlocksRead()); - - $settings->setBlocksRead(); - $this->assertTrue($settings->getBlocksRead()); - - $index->delete(); - } - - public function testGetSetBlocksWrite() - { - $index = $this->_createIndex('elastica-test'); - $index->refresh(); - $settings = $index->getSettings(); - - $this->assertFalse($settings->getBlocksWrite()); - - $settings->setBlocksWrite(true); - $this->assertTrue($settings->getBlocksWrite()); - - $settings->setBlocksWrite(false); - $this->assertFalse($settings->getBlocksWrite()); - - $settings->setBlocksWrite(); - $this->assertTrue($settings->getBlocksWrite()); - - $index->delete(); - } - - public function testGetSetBlocksMetadata() - { - $index = $this->_createIndex('elastica-test'); - $index->refresh(); - $settings = $index->getSettings(); - - $this->assertFalse($settings->getBlocksMetadata()); - - $settings->setBlocksMetadata(true); - $this->assertTrue($settings->getBlocksMetadata()); - - $settings->setBlocksMetadata(false); - $this->assertFalse($settings->getBlocksMetadata()); - - $settings->setBlocksMetadata(); - $this->assertTrue($settings->getBlocksMetadata()); - - $settings->setBlocksMetadata(false); // Cannot delete index otherwise - $index->delete(); - } - - protected function _waitForAllocation(Index $index) - { - do { - $settings = $index->getStatus()->get(); - $allocated = true; - foreach ($settings['shards'] as $shard) { - if ($shard[0]['routing']['state'] != 'STARTED') { - $allocated = false; - } - } - } while (!$allocated); - } -} diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatsTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatsTest.php deleted file mode 100644 index 5e8e8d57..00000000 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatsTest.php +++ /dev/null @@ -1,23 +0,0 @@ -_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - $stats = $index->getStats(); - $this->assertInstanceOf('Elastica\Index\Stats', $stats); - - $this->assertTrue($stats->getResponse()->isOk()); - $this->assertEquals(0, $stats->get('_all', 'indices', 'test', 'primaries', 'docs', 'count')); - } -} diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php deleted file mode 100644 index 8a056a53..00000000 --- a/vendor/ruflin/elastica/test/lib/Elastica/Test/Index/StatusTest.php +++ /dev/null @@ -1,66 +0,0 @@ -_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - - $status = new IndexStatus($index); - - $aliases = $status->getAliases(); - - $this->assertTrue(empty($aliases)); - $this->assertInternalType('array', $aliases); - - $index->addAlias($aliasName); - $status->refresh(); - - $aliases = $status->getAliases(); - - $this->assertTrue(in_array($aliasName, $aliases)); - } - - public function testHasAlias() - { - $indexName = 'test'; - $aliasName = 'test-alias'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - - $status = new IndexStatus($index); - - $this->assertFalse($status->hasAlias($aliasName)); - - $index->addAlias($aliasName); - $status->refresh(); - - $this->assertTrue($status->hasAlias($aliasName)); - } - - public function testGetSettings() - { - $indexName = 'test'; - - $client = $this->_getClient(); - $index = $client->getIndex($indexName); - $index->create(array(), true); - $status = $index->getStatus(); - - $settings = $status->getSettings(); - $this->assertInternalType('array', $settings); - $this->assertTrue(isset($settings['index']['number_of_shards'])); - } -} -- cgit v1.2.3-54-g00ecf