Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Fixed functional test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
katmsft committed Mar 31, 2017
1 parent e7d1e5d commit 9aa46e3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Common/Internal/ACLBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function addSignedIdentifier(

// There can be no more than 5 signed identifiers at the same time.
Validate::isTrue(
count($this->getSignedIdentifiers()) <= 5,
count($this->getSignedIdentifiers()) < 5,
Resources::ERROR_TOO_MANY_SIGNED_IDENTIFIERS
);

Expand Down
8 changes: 0 additions & 8 deletions src/Common/Internal/Serialization/MessageSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class MessageSerializer
* Serialize a message to a string. The message object must be either a type
* of \Exception, or have following methods implemented.
* getHeaders()
* getBody()
* getProtocolVersion()
* (getUri() && getMethod()) || (getStatusCode() && getReasonPhrase())
*
Expand All @@ -65,7 +64,6 @@ public static function objectSerialize($targetObject)
}

Validate::methodExists($targetObject, 'getHeaders', 'targetObject');
Validate::methodExists($targetObject, 'getBody', 'targetObject');
Validate::methodExists($targetObject, 'getProtocolVersion', 'targetObject');

// Serialize according to the implemented method.
Expand All @@ -85,7 +83,6 @@ public static function objectSerialize($targetObject)
/**
* Serialize the request type that implemented the following methods:
* getHeaders()
* getBody()
* getProtocolVersion()
* getUri()
* getMethod()
Expand All @@ -97,23 +94,20 @@ public static function objectSerialize($targetObject)
private static function serializeRequest($request)
{
$headers = $request->getHeaders();
$body = $request->getBody();
$version = $request->getProtocolVersion();
$uri = $request->getUri();
$method = $request->getMethod();

$resultString = "Request:\n";
$resultString .= "URI: {$uri}\nHTTP Version: {$version}\nMethod: {$method}\n";
$resultString .= self::serializeHeaders($headers);
$resultString .= "Request Body:\n{$body}\n";

return $resultString;
}

/**
* Serialize the response type that implemented the following methods:
* getHeaders()
* getBody()
* getProtocolVersion()
* getStatusCode()
* getReasonPhrase()
Expand All @@ -125,7 +119,6 @@ private static function serializeRequest($request)
private static function serializeResponse($response)
{
$headers = $response->getHeaders();
$body = $response->getBody();
$version = $response->getProtocolVersion();
$status = $response->getStatusCode();
$reason = $response->getReasonPhrase();
Expand All @@ -134,7 +127,6 @@ private static function serializeResponse($response)
$resultString .= "Status Code: {$status}\nReason: {$reason}\n";
$resultString .= "HTTP Version: {$version}\n";
$resultString .= self::serializeHeaders($headers);
$resultString .= "Request Body:\n{$body}\n";

return $resultString;
}
Expand Down
20 changes: 12 additions & 8 deletions tests/functional/Blob/BlobServiceFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Client;

class BlobServiceFunctionalTest extends FunctionalTestBase
{
Expand Down Expand Up @@ -1194,14 +1195,17 @@ private function verifySetContainerACLWorker($ret, $container, $acl, $blobConten

private function canDownloadFromUrl($blobAddress, $expectedStartingValue)
{
$url = parse_url($blobAddress);
$host = $url['host'];
$fp = fsockopen($host, '80');
$request = 'GET ' . $blobAddress . ' HTTP/1.1' . "\r\n" . 'Host: ' . $host ."\r\n\r\n";
fputs($fp, $request);
$value = fread($fp, 1000);
fclose($fp);
return strpos($value, $expectedStartingValue) !== false;
$client = new Client();
$body = '';
try {
$response = $client->request('GET', $blobAddress);
$body = $response->getBody();
} catch (RequestException $e) {
if ($e->hasResponse()) {
$body = $e->getResponse()->getBody();
}
}
return strpos($body, $expectedStartingValue) !== false;
}

/**
Expand Down
5 changes: 4 additions & 1 deletion tests/functional/Queue/QueueServiceFunctionalTestData.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@

class QueueServiceFunctionalTestData
{
const INTERESTING_TTL = 4;
//Needs to keep this value as low as possible to quicken the test
//but if the test machine is slow, a small value will cause unexpected
//failures. Default value: 20.
const INTERESTING_TTL = 20;
public static $testUniqueId;
public static $tempQueueCounter;
public static $nonExistQueuePrefix;
Expand Down
1 change: 0 additions & 1 deletion tests/unit/Table/Models/EdmTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ public function testValidateEdmValueWithDouble()
$values[] = PHP_INT_MAX;
$values[] = pi();
$values[] = 1.0;
$values[] = PHP_INT_MIN;
$expected = true;

// Test
Expand Down

0 comments on commit 9aa46e3

Please sign in to comment.