Increase fed share timeout from 3 to 10 + unit tests
This commit is contained in:
parent
3e763ac81e
commit
ec968a48e4
|
@ -85,8 +85,8 @@ class DiscoveryManager {
|
||||||
// Read the data from the response body
|
// Read the data from the response body
|
||||||
try {
|
try {
|
||||||
$response = $this->client->get($remote . '/ocs-provider/', [
|
$response = $this->client->get($remote . '/ocs-provider/', [
|
||||||
'timeout' => 3,
|
'timeout' => 10,
|
||||||
'connect_timeout' => 3,
|
'connect_timeout' => 10,
|
||||||
]);
|
]);
|
||||||
if($response->getStatusCode() === 200) {
|
if($response->getStatusCode() === 200) {
|
||||||
$decodedService = json_decode($response->getBody(), true);
|
$decodedService = json_decode($response->getBody(), true);
|
||||||
|
|
|
@ -288,8 +288,8 @@ class Notifications {
|
||||||
try {
|
try {
|
||||||
$response = $client->post($protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, [
|
$response = $client->post($protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, [
|
||||||
'body' => $fields,
|
'body' => $fields,
|
||||||
'timeout' => 3,
|
'timeout' => 10,
|
||||||
'connect_timeout' => 3,
|
'connect_timeout' => 10,
|
||||||
]);
|
]);
|
||||||
$result['result'] = $response->getBody();
|
$result['result'] = $response->getBody();
|
||||||
$result['success'] = true;
|
$result['success'] = true;
|
||||||
|
|
|
@ -77,7 +77,10 @@ class DiscoveryManagerTest extends \Test\TestCase {
|
||||||
$this->client
|
$this->client
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('https://myhost.com/ocs-provider/', [])
|
->with('https://myhost.com/ocs-provider/', [
|
||||||
|
'timeout' => 10,
|
||||||
|
'connect_timeout' => 10,
|
||||||
|
])
|
||||||
->willReturn($response);
|
->willReturn($response);
|
||||||
$this->cache
|
$this->cache
|
||||||
->expects($this->at(0))
|
->expects($this->at(0))
|
||||||
|
@ -111,7 +114,10 @@ class DiscoveryManagerTest extends \Test\TestCase {
|
||||||
$this->client
|
$this->client
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('https://myhost.com/ocs-provider/', [])
|
->with('https://myhost.com/ocs-provider/', [
|
||||||
|
'timeout' => 10,
|
||||||
|
'connect_timeout' => 10,
|
||||||
|
])
|
||||||
->willReturn($response);
|
->willReturn($response);
|
||||||
|
|
||||||
$expectedResult = '/public.php/MyCustomEndpoint/';
|
$expectedResult = '/public.php/MyCustomEndpoint/';
|
||||||
|
@ -131,7 +137,10 @@ class DiscoveryManagerTest extends \Test\TestCase {
|
||||||
$this->client
|
$this->client
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('https://myhost.com/ocs-provider/', [])
|
->with('https://myhost.com/ocs-provider/', [
|
||||||
|
'timeout' => 10,
|
||||||
|
'connect_timeout' => 10,
|
||||||
|
])
|
||||||
->willReturn($response);
|
->willReturn($response);
|
||||||
|
|
||||||
$expectedResult = '/public.php/webdav';
|
$expectedResult = '/public.php/webdav';
|
||||||
|
@ -151,7 +160,10 @@ class DiscoveryManagerTest extends \Test\TestCase {
|
||||||
$this->client
|
$this->client
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('https://myhost.com/ocs-provider/', [])
|
->with('https://myhost.com/ocs-provider/', [
|
||||||
|
'timeout' => 10,
|
||||||
|
'connect_timeout' => 10,
|
||||||
|
])
|
||||||
->willReturn($response);
|
->willReturn($response);
|
||||||
|
|
||||||
$expectedResult = '/ocs/v2.php/cloud/MyCustomShareEndpoint';
|
$expectedResult = '/ocs/v2.php/cloud/MyCustomShareEndpoint';
|
||||||
|
@ -171,7 +183,10 @@ class DiscoveryManagerTest extends \Test\TestCase {
|
||||||
$this->client
|
$this->client
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
->method('get')
|
->method('get')
|
||||||
->with('https://myhost.com/ocs-provider/', [])
|
->with('https://myhost.com/ocs-provider/', [
|
||||||
|
'timeout' => 10,
|
||||||
|
'connect_timeout' => 10,
|
||||||
|
])
|
||||||
->willReturn($response);
|
->willReturn($response);
|
||||||
$this->cache
|
$this->cache
|
||||||
->expects($this->at(0))
|
->expects($this->at(0))
|
||||||
|
|
|
@ -78,8 +78,8 @@ $externalManager = new \OCA\Files_Sharing\External\Manager(
|
||||||
if (substr($remote, 0, 5) === 'https') {
|
if (substr($remote, 0, 5) === 'https') {
|
||||||
try {
|
try {
|
||||||
\OC::$server->getHTTPClientService()->newClient()->get($remote, [
|
\OC::$server->getHTTPClientService()->newClient()->get($remote, [
|
||||||
'timeout' => 3,
|
'timeout' => 10,
|
||||||
'connect_timeout' => 3,
|
'connect_timeout' => 10,
|
||||||
])->getBody();
|
])->getBody();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\OCP\JSON::error(array('data' => array('message' => $l->t('Invalid or untrusted SSL certificate'))));
|
\OCP\JSON::error(array('data' => array('message' => $l->t('Invalid or untrusted SSL certificate'))));
|
||||||
|
|
|
@ -255,8 +255,8 @@ class Storage extends DAV implements ISharedStorage {
|
||||||
$client = $this->httpClient->newClient();
|
$client = $this->httpClient->newClient();
|
||||||
try {
|
try {
|
||||||
$result = $client->get($url, [
|
$result = $client->get($url, [
|
||||||
'timeout' => 3,
|
'timeout' => 10,
|
||||||
'connect_timeout' => 3,
|
'connect_timeout' => 10,
|
||||||
])->getBody();
|
])->getBody();
|
||||||
$data = json_decode($result);
|
$data = json_decode($result);
|
||||||
$returnValue = (is_object($data) && !empty($data->version));
|
$returnValue = (is_object($data) && !empty($data->version));
|
||||||
|
@ -306,8 +306,8 @@ class Storage extends DAV implements ISharedStorage {
|
||||||
try {
|
try {
|
||||||
$response = $client->post($url, [
|
$response = $client->post($url, [
|
||||||
'body' => ['password' => $password],
|
'body' => ['password' => $password],
|
||||||
'timeout' => 3,
|
'timeout' => 10,
|
||||||
'connect_timeout' => 3,
|
'connect_timeout' => 10,
|
||||||
]);
|
]);
|
||||||
} catch (\GuzzleHttp\Exception\RequestException $e) {
|
} catch (\GuzzleHttp\Exception\RequestException $e) {
|
||||||
if ($e->getCode() === 401 || $e->getCode() === 403) {
|
if ($e->getCode() === 401 || $e->getCode() === 403) {
|
||||||
|
|
Loading…
Reference in New Issue