Skip to content

Commit

Permalink
Tuning test
Browse files Browse the repository at this point in the history
  • Loading branch information
hirak committed Feb 20, 2016
1 parent 49df8d3 commit 3d792d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/CurlMulti.php
Expand Up @@ -106,7 +106,7 @@ public function wait()
do {
$stat = curl_multi_exec($this->mh, $running);
} while ($stat === CURLM_CALL_MULTI_PERFORM);
if (-1 === curl_multi_select($this->mh, 10)) {
if (-1 === curl_multi_select($this->mh)) {
// @codeCoverageIgnoreStart
if ($retryCnt++ > 10) {
throw new \RuntimeException('curl_multi_select failure');
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/ParallelDownloaderTest.php
Expand Up @@ -80,16 +80,16 @@ public function testDownloadSuccess()
//success requests
$packages = array(
$p1 = $this->createPackage('vendor/package1', 'http://localhost:1337/?wait=1', $ref),
$p2 = $this->createPackage('vendor/package2', 'http://localhost:1337/?wait=2', $ref),
$p3 = $this->createPackage('vendor/package3', 'http://localhost:1337/?wait=3', $ref),
$p2 = $this->createPackage('vendor/package2', 'http://localhost:1337/?wait=1', $ref),
$p3 = $this->createPackage('vendor/package3', 'http://localhost:1337/?wait=1', $ref),
);
$pluginConfig = new Config(array());
$this->downloader->download($packages, $pluginConfig->get());
self::assertLessThan(6, microtime(true) - $start, '1s + 2s + 3s must be less than < 6s in parallel download.');
self::assertLessThan(3, microtime(true) - $start, '1s + 1s + 1s must be less than < 3s in parallel download.');

$cache1 = FileDownloaderDummy::getCacheKeyCompat($p1, 'http://localhost:1337/?wait=1');
$cache2 = FileDownloaderDummy::getCacheKeyCompat($p2, 'http://localhost:1337/?wait=2');
$cache3 = FileDownloaderDummy::getCacheKeyCompat($p3, 'http://localhost:1337/?wait=3');
$cache2 = FileDownloaderDummy::getCacheKeyCompat($p2, 'http://localhost:1337/?wait=1');
$cache3 = FileDownloaderDummy::getCacheKeyCompat($p3, 'http://localhost:1337/?wait=1');
self::assertFileExists("tests/workspace/cache/$cache1");
self::assertFileExists("tests/workspace/cache/$cache2");
self::assertFileExists("tests/workspace/cache/$cache3");
Expand Down

0 comments on commit 3d792d8

Please sign in to comment.