Skip to content

Commit

Permalink
putting // slashes in a request for alias fail on ES6.x (#1355)
Browse files Browse the repository at this point in the history
  • Loading branch information
p365labs authored and ruflin committed Aug 22, 2017
1 parent 1822bc9 commit 48dc8ef
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
4 changes: 1 addition & 3 deletions test/Elastica/Connection/Strategy/CallbackStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public function testFailIsValid()
*/
public function testConnection()
{
$this->markTestSkipped('ES6 update: Incorrect HTTP method for uri [//_aliases] and method [GET], allowed: [PUT]');

$count = 0;

$config = ['connectionStrategy' => function ($connections) use (&$count) {
Expand All @@ -86,7 +84,7 @@ public function testConnection()
}];

$client = $this->_getClient($config);
$response = $client->request('/_aliases');
$response = $client->request('_aliases');

$this->assertEquals(1, $count);

Expand Down
12 changes: 4 additions & 8 deletions test/Elastica/Connection/Strategy/RoundRobinTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ class RoundRobinTest extends Base
*/
public function testConnection()
{
$this->markTestSkipped('ES6 update: Incorrect HTTP method for uri [//_aliases] and method [GET], allowed: [PUT]');

$config = ['connectionStrategy' => 'RoundRobin'];
$client = $this->_getClient($config);
$response = $client->request('/_aliases');
$response = $client->request('_aliases');
/* @var $response Response */

$this->_checkResponse($response);
Expand Down Expand Up @@ -58,16 +56,14 @@ public function testFailConnection()

$this->_checkStrategy($client);

$client->request('/_aliases');
$client->request('_aliases');
}

/**
* @group functional
*/
public function testWithOneFailConnection()
{
$this->markTestSkipped('ES6 update: Incorrect HTTP method for uri [//_aliases] and method [GET], allowed: [PUT]');

$connections = [
new Connection(['host' => '255.255.255.0', 'timeout' => $this->_timeout]),
new Connection(['host' => $this->_getHost(), 'timeout' => $this->_timeout]),
Expand All @@ -81,7 +77,7 @@ public function testWithOneFailConnection()
$client = $this->_getClient(['connectionStrategy' => 'RoundRobin'], $callback);
$client->setConnections($connections);

$response = $client->request('/_aliases');
$response = $client->request('_aliases');
/* @var $response Response */

$this->_checkResponse($response);
Expand Down Expand Up @@ -110,7 +106,7 @@ public function testWithNoValidConnection()
$client->setConnections($connections);

try {
$client->request('/_aliases');
$client->request('_aliases');
$this->fail('Should throw exception as no connection valid');
} catch (ConnectionException $e) {
$this->assertEquals(count($connections), $count);
Expand Down
12 changes: 4 additions & 8 deletions test/Elastica/Connection/Strategy/SimpleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ class SimpleTest extends Base
*/
public function testConnection()
{
$this->markTestSkipped('ES6 update: Incorrect HTTP method for uri [//_aliases] and method [GET], allowed: [PUT]');

$client = $this->_getClient();
$response = $client->request('/_aliases');
$response = $client->request('_aliases');

$this->_checkResponse($response);

Expand All @@ -44,16 +42,14 @@ public function testFailConnection()

$this->_checkStrategy($client);

$client->request('/_aliases');
$client->request('_aliases');
}

/**
* @group functional
*/
public function testWithOneFailConnection()
{
$this->markTestSkipped('ES6 update: Incorrect HTTP method for uri [//_aliases] and method [GET], allowed: [PUT]');

$connections = [
new Connection(['host' => '255.255.255.0', 'timeout' => $this->_timeout]),
new Connection(['host' => $this->_getHost(), 'timeout' => $this->_timeout]),
Expand All @@ -67,7 +63,7 @@ public function testWithOneFailConnection()
$client = $this->_getClient([], $callback);
$client->setConnections($connections);

$response = $client->request('/_aliases');
$response = $client->request('_aliases');
/* @var $response Response */

$this->_checkResponse($response);
Expand Down Expand Up @@ -96,7 +92,7 @@ public function testWithNoValidConnection()
$client->setConnections($connections);

try {
$client->request('/_aliases');
$client->request('_aliases');
$this->fail('Should throw exception as no connection valid');
} catch (ConnectionException $e) {
$this->assertEquals(count($connections), $count);
Expand Down

0 comments on commit 48dc8ef

Please sign in to comment.