diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-09-09 11:08:55 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-09-09 11:08:55 +0200 |
commit | c4c9c5ffad9a67c6f0b19a567ac99aa6e97840de (patch) | |
tree | 491bad7bcdb7a365bd20a17c20fa43745bdbecee /tests | |
parent | acee9d4750657cd8b48c92990b0200ae29f3fa8f (diff) | |
parent | 6ccbf4bce64bc7016d65f270c22f37fdbca8e21f (diff) | |
download | nextcloud-server-c4c9c5ffad9a67c6f0b19a567ac99aa6e97840de.tar.gz nextcloud-server-c4c9c5ffad9a67c6f0b19a567ac99aa6e97840de.zip |
Merge pull request #18684 from owncloud/explicit-upgrade-version
Explicit upgrade version + prevent downgrades
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/updater.php | 74 |
1 files changed, 64 insertions, 10 deletions
diff --git a/tests/lib/updater.php b/tests/lib/updater.php index 28577071b4c..763858acf5d 100644 --- a/tests/lib/updater.php +++ b/tests/lib/updater.php @@ -67,14 +67,68 @@ class UpdaterTest extends \Test\TestCase { */ public function versionCompatibilityTestData() { return [ - ['1.0.0.0', '2.2.0', true], - ['1.1.1.1', '2.0.0', true], - ['5.0.3', '4.0.3', false], - ['12.0.3', '13.4.5', true], - ['1', '2', true], - ['2', '2', true], - ['6.0.5', '6.0.6', true], - ['5.0.6', '7.0.4', false], + ['1', '2', '1', true], + ['2', '2', '2', true], + ['6.0.5.0', '6.0.6.0', '5.0', true], + ['5.0.6.0', '7.0.4.0', '6.0', false], + // allow upgrading within the same major release + ['8.0.0.0', '8.0.0.0', '8.0', true], + ['8.0.0.0', '8.0.0.4', '8.0', true], + ['8.0.0.0', '8.0.1.0', '8.0', true], + ['8.0.0.0', '8.0.2.0', '8.0', true], + // does not allow downgrading within the same major release + ['8.0.1.0', '8.0.0.0', '8.0', false], + ['8.0.2.0', '8.0.1.0', '8.0', false], + ['8.0.0.4', '8.0.0.0', '8.0', false], + // allows upgrading within the patch version + ['8.0.0.0', '8.0.0.1', '8.0', true], + ['8.0.0.0', '8.0.0.2', '8.0', true], + // does not allow downgrading within the same major release + ['8.0.0.1', '8.0.0.0', '8.0', false], + ['8.0.0.2', '8.0.0.0', '8.0', false], + // allow upgrading to the next major release + ['8.0.0.0', '8.1.0.0', '8.0', true], + ['8.0.0.0', '8.1.1.0', '8.0', true], + ['8.0.0.0', '8.1.1.5', '8.0', true], + ['8.0.0.2', '8.1.1.5', '8.0', true], + ['8.1.0.0', '8.2.0.0', '8.1', true], + ['8.1.0.2', '8.2.0.4', '8.1', true], + ['8.1.0.5', '8.2.0.1', '8.1', true], + ['8.1.0.0', '8.2.1.0', '8.1', true], + ['8.1.0.2', '8.2.1.5', '8.1', true], + ['8.1.0.5', '8.2.1.1', '8.1', true], + // does not allow downgrading to the previous major release + ['8.1.0.0', '8.0.0.0', '7.0', false], + ['8.1.1.0', '8.0.0.0', '7.0', false], + // does not allow skipping major releases + ['8.0.0.0', '8.2.0.0', '8.1', false], + ['8.0.0.0', '8.2.1.0', '8.1', false], + ['8.0.0.0', '9.0.1.0', '8.2', false], + ['8.0.0.0', '10.0.0.0', '9.3', false], + // allows updating to the next major release + ['8.2.0.0', '9.0.0.0', '8.2', true], + ['8.2.0.0', '9.0.0.0', '8.2', true], + ['8.2.0.0', '9.0.1.0', '8.2', true], + ['8.2.0.0', '9.0.1.1', '8.2', true], + ['8.2.0.2', '9.0.1.1', '8.2', true], + ['8.2.2.0', '9.0.1.0', '8.2', true], + ['8.2.2.2', '9.0.1.1', '8.2', true], + ['9.0.0.0', '9.1.0.0', '9.0', true], + ['9.0.0.0', '9.1.0.2', '9.0', true], + ['9.0.0.2', '9.1.0.1', '9.0', true], + ['9.1.0.0', '9.2.0.0', '9.1', true], + ['9.2.0.0', '9.3.0.0', '9.2', true], + ['9.3.0.0', '10.0.0.0', '9.3', true], + // does not allow updating to the next major release (first number) + ['9.0.0.0', '8.2.0.0', '8.1', false], + // other cases + ['8.0.0.0', '8.1.5.0', '8.0', true], + ['8.2.0.0', '9.0.0.0', '8.2', true], + ['8.2.0.0', '9.1.0.0', '9.0', false], + ['9.0.0.0', '8.1.0.0', '8.0', false], + ['9.0.0.0', '8.0.0.0', '7.0', false], + ['9.1.0.0', '8.0.0.0', '7.0', false], + ['8.2.0.0', '8.1.0.0', '8.0', false], ]; } @@ -106,9 +160,9 @@ class UpdaterTest extends \Test\TestCase { * @param string $newVersion * @param bool $result */ - public function testIsUpgradePossible($oldVersion, $newVersion, $result) { + public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersion, $result) { $updater = new Updater($this->httpHelper, $this->config); - $this->assertSame($result, $updater->isUpgradePossible($oldVersion, $newVersion)); + $this->assertSame($result, $updater->isUpgradePossible($oldVersion, $newVersion, $allowedVersion)); } public function testCheckInCache() { |