Fixed a issue where functional test in queue reports failure when checking visibility timeout behavior

This commit is contained in:
Tank Tang 2016-11-17 15:13:42 +08:00
Родитель 716d591ce5
Коммит fdd42ff23c
3 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -767,7 +767,7 @@ class QueueRestProxy extends ServiceRestProxy implements IQueue
$body = $message->toXml($this->dataSerializer);
}
$response = $this->send(
$response = $this->send(
$method,
$headers,
$queryParams,

Просмотреть файл

@ -65,8 +65,11 @@ class QueueServiceRestProxyTestBase extends ServiceRestProxyTestBase
try {
$this->deleteQueue($queueName);
} catch (\Exception $e) {
// Ignore exception and continue, will assume that this queue doesn't exist in the sotrage account
error_log($e->getMessage());
// Ignore exception and continue if the error message shows that the
// queue does not exist.
if (strpos($e->getMessage(), 'specified queue does not exist') == false) {
throw $e;
};
}
}

Просмотреть файл

@ -1156,7 +1156,13 @@ class QueueServiceFunctionalTest extends FunctionalTestBase
sleep(QueueServiceFunctionalTestData::INTERESTING_TTL);
// Try again, not that the 4 second visibility has passed
$lmr = $this->restProxy->listMessages($queue);
if ($visibilityTimeoutInSeconds >= QueueServiceFunctionalTestData::INTERESTING_TTL) {
//Because no matter how quick the connection and machine is, the
//execution between updating the visibility timeout and running
//the following lines require some time. So if the visibility
//time out is exactly the same value as waited time, the message
//is considered visable again because the visibility timeout
//expired.
if ($visibilityTimeoutInSeconds > QueueServiceFunctionalTestData::INTERESTING_TTL) {
$this->assertEquals(0, count($lmr->getQueueMessages()), 'getQueueMessages() count');
} else {
$this->assertEquals(1, count($lmr->getQueueMessages()), 'getQueueMessages() count');