-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/clone-output
- Loading branch information
Showing
5 changed files
with
333 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"require": { | ||
"psr/log": "~1.1.3", | ||
"psr/cache": "~1.0.0" | ||
}, | ||
"extra": { | ||
"violinist": { | ||
"number_of_concurrent_updates": 1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
{ | ||
"_readme": [ | ||
"This file locks the dependencies of your project to a known state", | ||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", | ||
"This file is @generated automatically" | ||
], | ||
"content-hash": "c8ba547438f3b94d6e7e25fedfea753f", | ||
"packages": [ | ||
{ | ||
"name": "psr/cache", | ||
"version": "1.0.0", | ||
"source": { | ||
"type": "git", | ||
"url": "https://github.com/php-fig/cache.git", | ||
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3" | ||
}, | ||
"dist": { | ||
"type": "zip", | ||
"url": "https://api.github.com/repos/php-fig/cache/zipball/9e66031f41fbbdda45ee11e93c45d480ccba3eb3", | ||
"reference": "9e66031f41fbbdda45ee11e93c45d480ccba3eb3", | ||
"shasum": "" | ||
}, | ||
"require": { | ||
"php": ">=5.3.0" | ||
}, | ||
"type": "library", | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.0.x-dev" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Psr\\Cache\\": "src/" | ||
} | ||
}, | ||
"notification-url": "https://packagist.org/downloads/", | ||
"license": [ | ||
"MIT" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "PHP-FIG", | ||
"homepage": "http://www.php-fig.org/" | ||
} | ||
], | ||
"description": "Common interface for caching libraries", | ||
"keywords": [ | ||
"cache", | ||
"psr", | ||
"psr-6" | ||
], | ||
"support": { | ||
"issues": "https://github.com/php-fig/cache/issues", | ||
"source": "https://github.com/php-fig/cache/tree/master" | ||
}, | ||
"time": "2015-12-11T02:52:07+00:00" | ||
}, | ||
{ | ||
"name": "psr/log", | ||
"version": "1.1.3", | ||
"source": { | ||
"type": "git", | ||
"url": "https://github.com/php-fig/log.git", | ||
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" | ||
}, | ||
"dist": { | ||
"type": "zip", | ||
"url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", | ||
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", | ||
"shasum": "" | ||
}, | ||
"require": { | ||
"php": ">=5.3.0" | ||
}, | ||
"type": "library", | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.1.x-dev" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Psr\\Log\\": "Psr/Log/" | ||
} | ||
}, | ||
"notification-url": "https://packagist.org/downloads/", | ||
"license": [ | ||
"MIT" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "PHP-FIG", | ||
"homepage": "http://www.php-fig.org/" | ||
} | ||
], | ||
"description": "Common interface for logging libraries", | ||
"homepage": "https://github.com/php-fig/log", | ||
"keywords": [ | ||
"log", | ||
"psr", | ||
"psr-3" | ||
], | ||
"support": { | ||
"source": "https://github.com/php-fig/log/tree/1.1.3" | ||
}, | ||
"time": "2020-03-23T09:12:05+00:00" | ||
} | ||
], | ||
"packages-dev": [], | ||
"aliases": [], | ||
"minimum-stability": "stable", | ||
"stability-flags": [], | ||
"prefer-stable": false, | ||
"prefer-lowest": false, | ||
"platform": [], | ||
"platform-dev": [], | ||
"plugin-api-version": "2.3.0" | ||
} |
118 changes: 118 additions & 0 deletions
118
test/fixtures/composer.concurrent.update_branch.lock.updated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
{ | ||
"_readme": [ | ||
"This file locks the dependencies of your project to a known state", | ||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", | ||
"This file is @generated automatically" | ||
], | ||
"content-hash": "c8ba547438f3b94d6e7e25fedfea753f", | ||
"packages": [ | ||
{ | ||
"name": "psr/cache", | ||
"version": "1.0.1", | ||
"source": { | ||
"type": "git", | ||
"url": "https://github.com/php-fig/cache.git", | ||
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" | ||
}, | ||
"dist": { | ||
"type": "zip", | ||
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", | ||
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", | ||
"shasum": "" | ||
}, | ||
"require": { | ||
"php": ">=5.3.0" | ||
}, | ||
"type": "library", | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.0.x-dev" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Psr\\Cache\\": "src/" | ||
} | ||
}, | ||
"notification-url": "https://packagist.org/downloads/", | ||
"license": [ | ||
"MIT" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "PHP-FIG", | ||
"homepage": "http://www.php-fig.org/" | ||
} | ||
], | ||
"description": "Common interface for caching libraries", | ||
"keywords": [ | ||
"cache", | ||
"psr", | ||
"psr-6" | ||
], | ||
"support": { | ||
"source": "https://github.com/php-fig/cache/tree/master" | ||
}, | ||
"time": "2016-08-06T20:24:11+00:00" | ||
}, | ||
{ | ||
"name": "psr/log", | ||
"version": "1.1.4", | ||
"source": { | ||
"type": "git", | ||
"url": "https://github.com/php-fig/log.git", | ||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11" | ||
}, | ||
"dist": { | ||
"type": "zip", | ||
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", | ||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11", | ||
"shasum": "" | ||
}, | ||
"require": { | ||
"php": ">=5.3.0" | ||
}, | ||
"type": "library", | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "1.1.x-dev" | ||
} | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Psr\\Log\\": "Psr/Log/" | ||
} | ||
}, | ||
"notification-url": "https://packagist.org/downloads/", | ||
"license": [ | ||
"MIT" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "PHP-FIG", | ||
"homepage": "https://www.php-fig.org/" | ||
} | ||
], | ||
"description": "Common interface for logging libraries", | ||
"homepage": "https://github.com/php-fig/log", | ||
"keywords": [ | ||
"log", | ||
"psr", | ||
"psr-3" | ||
], | ||
"support": { | ||
"source": "https://github.com/php-fig/log/tree/1.1.4" | ||
}, | ||
"time": "2021-05-03T11:20:27+00:00" | ||
} | ||
], | ||
"packages-dev": [], | ||
"aliases": [], | ||
"minimum-stability": "stable", | ||
"stability-flags": [], | ||
"prefer-stable": false, | ||
"prefer-lowest": false, | ||
"platform": [], | ||
"platform-dev": [], | ||
"plugin-api-version": "2.3.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
namespace eiriksm\CosyComposerTest\integration; | ||
|
||
use eiriksm\ArrayOutput\ArrayOutput; | ||
|
||
class UpdateConcurrentOutdatedBranchTest extends ComposerUpdateIntegrationBase | ||
{ | ||
protected $composerAssetFiles = 'composer.concurrent.update_branch'; | ||
private $sha; | ||
|
||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->sha = 123; | ||
|
||
$mock_output = $this->createMock(ArrayOutput::class); | ||
$mock_output->method('fetch') | ||
->willReturn([ | ||
[ | ||
'{"installed": [{"name": "psr/cache", "version": "1.0.0", "latest": "1.0.1", "latest-status": "semver-safe-update"},{"name": "psr/log", "version": "1.1.3", "latest": "1.1.4", "latest-status": "semver-safe-update"}]}', | ||
] | ||
]); | ||
$this->cosy->setOutput($mock_output); | ||
} | ||
|
||
public function testUpdateConcurrentWithOutdatedBranch() | ||
{ | ||
$this->sha = '456'; | ||
$this->runtestExpectedOutput(); | ||
// This means we expect the first package (psr/cache) to be updated, since the PR is out of date. This should | ||
// show in the messages then. | ||
$this->assertOutputContainsMessage('Creating pull request from psrcache100101', $this->cosy); | ||
$msg = $this->findMessage('Running composer update for package psr/log', $this->cosy); | ||
self::assertFalse($msg); | ||
} | ||
|
||
public function testUpdateConcurrentWithUpToDateBranch() | ||
{ | ||
$this->runtestExpectedOutput(); | ||
$this->assertOutputContainsMessage('Skipping psr/cache because a pull request already exists', $this->cosy); | ||
$this->assertOutputContainsMessage('Skipping psr/log because the number of max concurrent PRs (1) seems to have been reached', $this->cosy); | ||
} | ||
|
||
protected function handleExecutorReturnCallback($cmd, &$return) | ||
{ | ||
$packages = [ | ||
'psr/log', | ||
'psr/cache', | ||
]; | ||
foreach ($packages as $package) { | ||
$expected_command = $this->createExpectedCommandForPackage($package); | ||
if ($expected_command === $cmd) { | ||
$this->placeUpdatedComposerLock(); | ||
} | ||
} | ||
} | ||
|
||
protected function getPrsNamed() | ||
{ | ||
return [ | ||
'psrcache100101' => [ | ||
'base' => [ | ||
'sha' => $this->sha, | ||
], | ||
'title' => 'Update psr/cache from 1.0.0 to 1.0.1', | ||
], | ||
]; | ||
} | ||
|
||
protected function getBranchesFlattened() | ||
{ | ||
return [ | ||
'psrcache100101', | ||
]; | ||
} | ||
} |