Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/updater.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-04-16 22:56:43 +0300
committerLukas Reschke <lukas@statuscode.ch>2017-04-16 23:20:43 +0300
commit50ea185406c8fa40bd24e7dbdbc088345049d2b4 (patch)
tree2715bdfcdb3a68b0fe045cf3c11a0581e48123c4
parent960c1aaaaf1c6ce3ab7579040a59e28baee4be99 (diff)
Add signatures to integration tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
-rw-r--r--tests/features/bootstrap/FeatureContext.php72
-rw-r--r--tests/features/cli.feature14
-rw-r--r--tests/features/master.feature1
-rw-r--r--tests/features/stable10.feature17
-rw-r--r--tests/features/stable11.feature4
-rw-r--r--tests/features/stable9.feature12
6 files changed, 104 insertions, 16 deletions
diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php
index 0f05432..7d8ef5a 100644
--- a/tests/features/bootstrap/FeatureContext.php
+++ b/tests/features/bootstrap/FeatureContext.php
@@ -1,12 +1,11 @@
<?php
-use Behat\Behat\Context\Context;
-use Behat\Behat\Tester\Exception\PendingException;
+use Behat\Behat\Context\SnippetAcceptingContext;
/**
* Defines application features from the specific context.
*/
-class FeatureContext implements Context
+class FeatureContext implements SnippetAcceptingContext
{
protected $buildDir;
protected $serverDir;
@@ -171,6 +170,57 @@ class FeatureContext implements Context
$this->CLIReturnCode = $returnCode;
}
+ /**
+ * @param $version
+ * @return string
+ */
+ public function getSignatureForVersion($version) {
+ $signatures = [
+ '9.0.54' => 'wVgtLXquICXsmfJwRUD8tJiFzYJAIdQfjAcOzvKGDYh96NMT6MGVEMYQgAfyYvq0
+tuAcqsU87CDc1IQ14y2GmkSnwnXJrCXEJFaYqBGyXJtbzRukby5k+IVx2NTBaNjL
+XMC1irGa7tnCC/pyn9K+RDDHSTa3aQ7W0Z2MIq+T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
+Be10XmB2QB6Xi0jvxjD9d3AYUFPH8Chy8rF6Wth7V7Eexyuh+4secrvuv7pqbuNt
+AmVRSYigLgIB5oVDd5BSvpeDe4ZhKN8qE1fDDTQX29iPvTn6M/FJZ3pH3ZrLRzgl
+9n97PTVFgtC2NdLYc7GD9bHxTUL1/iKvp7s9I6Tp6oxyBfOJwC4AqRTwURnG1ouZ
+EjMJzAibeG1AVDDbaU6irQ==',
+ '11.0.0beta' => 'LflrJaVMjHH1ntRlQ1mkgvQ86VTSFxvw77kcPt33tWVk6GLSMxpy+/71V3nGNHM2
+STd1czLzm+AUWdWWVluAci6XjJ7x+Tlsg5S7+ofuiwO1/m1nf5yXeHEf9q9ATqzy
+UkzEhCEbMF+9Zxd5WZZkexUZyVf/cfx8MBEsvsqqysHGgZJKmoJEwN2jCnKYIQzL
+yAvOWXjOA0xarzXxwdlTnkFEnzBvFeYAThcfBDdUBRbyCqVbpU7IBQoXZYCSAtac
+FBKNj6b48LDvE4BDnid8y/91q88WdL4QLy4wVFVPxbMIObfDeAnyLvG+p7La7V5G
+iPnnYL0Y2XIhbshkwWhS/Q==',
+ '11.0.0beta2' => 'WAzWUB8rgr/deeOnlBn084ysJe3Z8J2dSunkJNlNEtbbCBr2ALwZh6Xe41MXr2F/
+S6riPZk2uRmx5W2XZ+IUHSTVlAOKOQaflTlo3xConuKfcyojJ3PGsO8x7awtRNA7
+2GBBBTNKY9/q8eONztsBWY7O2pWMTqJKEuXiXQyAQ3IkqxQkMWoyxKU/zGWBdZad
+QYwN9zVszIoWo31nlVz7QSzUZ4iyEVnbY4gT5EVPKfflIPQblp2bN485pYamuPe5
+CYB6S4AUzuyYS2zxt7MMdoaWHXY8hxdst1AF/kGKZ5Bdct4qVw7pup77c+uMNBvT
+jFSE6+KKI+HAE132eaXY5A==',
+ ];
+
+ if(isset($signatures[$version])) {
+ return $signatures[$version];
+ }
+
+ return '';
+ }
+
/**
* @Given /there is an update to version ([0-9.]+) available/
*/
@@ -188,6 +238,7 @@ class FeatureContext implements Context
<url>https://download.nextcloud.com/server/releases/nextcloud-' . $version . '.zip</url>
<web>https://docs.nextcloud.org/server/10/admin_manual/maintenance/manual_upgrade.html</web>
<autoupdater>' . $this->autoupdater . '</autoupdater>
+ <signature>'.$this->getSignatureForVersion($version).'</signature>
</nextcloud>
';
file_put_contents($this->updateServerDir . 'index.php', $content);
@@ -195,7 +246,7 @@ class FeatureContext implements Context
}
/**
- * @Given /there is an update to prerelease version of (.*) available/
+ * @Given there is an update to prerelease version :version available
*/
public function thereIsAnUpdateToPrereleaseVersionAvailable($version)
{
@@ -211,6 +262,7 @@ class FeatureContext implements Context
<url>https://download.nextcloud.com/server/prereleases/nextcloud-' . $version . '.zip</url>
<web>https://docs.nextcloud.org/server/10/admin_manual/maintenance/manual_upgrade.html</web>
<autoupdater>1</autoupdater>
+ <signature>'.$this->getSignatureForVersion($version).'</signature>
</nextcloud>
';
file_put_contents($this->updateServerDir . 'index.php', $content);
@@ -302,6 +354,18 @@ class FeatureContext implements Context
}
/**
+ * @Given the current channel is :channel
+ * @param string $channel
+ */
+ public function theCurrentChannelIs($channel)
+ {
+
+ chdir($this->serverDir . 'nextcloud');
+ shell_exec('chmod +x occ');
+ exec('./occ config:system:set --value '.$channel.' updater.release.channel');
+ }
+
+ /**
* @Then /upgrade is (not required|required)/
*/
public function upgradeIs($state)
diff --git a/tests/features/cli.feature b/tests/features/cli.feature
index 0750a84..adb8f92 100644
--- a/tests/features/cli.feature
+++ b/tests/features/cli.feature
@@ -34,6 +34,20 @@ Feature: CLI updater
#And maintenance mode should be off
And upgrade is not required
+ Scenario: Update without valid signature is being offered - 10.0.0 to 10.0.2
+ Given the current installed version is 10.0.0
+ # This works because 10.0.2 is not in the signature list
+ And there is an update to version 10.0.2 available
+ When the CLI updater is run
+ Then the return code should not be 0
+ And the output should contain "Signature of update is not valid"
+ And the installed version should be 10.0.0
+# known issue:
+ And maintenance mode should be on
+# TODO - it should be:
+#And maintenance mode should be off
+ And upgrade is not required
+
Scenario: Update is available but autoupdate is disabled - 10.0.0 to 10.0.1
Given the current installed version is 10.0.0
And the autoupdater is disabled
diff --git a/tests/features/master.feature b/tests/features/master.feature
index 171b3d3..5fd4817 100644
--- a/tests/features/master.feature
+++ b/tests/features/master.feature
@@ -2,6 +2,7 @@ Feature: CLI updater - master base
Scenario: Update is available - master to master daily
Given the current installed version is master
+ And the current channel is "daily"
And there is an update to daily version of master available
And the version number is decreased in the config.php to enforce upgrade
When the CLI updater is run successfully
diff --git a/tests/features/stable10.feature b/tests/features/stable10.feature
index ad6ccb2..bcc5367 100644
--- a/tests/features/stable10.feature
+++ b/tests/features/stable10.feature
@@ -11,7 +11,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - 10.0.0 to 11.0beta
Given the current installed version is 10.0.0
- And there is an update to prerelease version of 11.0.0beta available
+ And there is an update to prerelease version "11.0.0beta" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 11.0.0
@@ -20,7 +20,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - 10.0.1 to 11.0beta
Given the current installed version is 10.0.1
- And there is an update to prerelease version of 11.0.0beta available
+ And there is an update to prerelease version "11.0.0beta" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 11.0.0
@@ -29,6 +29,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - 10.0.0 to stable10 daily
Given the current installed version is 10.0.0
+ And the current channel is "daily"
And there is an update to daily version of stable10 available
When the CLI updater is run successfully
And the output should contain "Update successful"
@@ -38,6 +39,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - 10.0.1 to stable10 daily
Given the current installed version is 10.0.1
+ And the current channel is "daily"
And there is an update to daily version of stable10 available
When the CLI updater is run successfully
And the output should contain "Update successful"
@@ -47,6 +49,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - stable10 to stable10 daily
Given the current installed version is stable10
+ And the current channel is "daily"
And there is an update to daily version of stable10 available
And the version number is decreased in the config.php to enforce upgrade
When the CLI updater is run successfully
@@ -57,7 +60,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - stable10 to 11.0.0 beta 2
Given the current installed version is stable10
- And there is an update to prerelease version of 11.0.0beta2 available
+ And there is an update to prerelease version "11.0.0beta2" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 11.0.0.5
@@ -66,7 +69,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - 10.0.0 to 11.0.0 beta 2
Given the current installed version is 10.0.0
- And there is an update to prerelease version of 11.0.0beta2 available
+ And there is an update to prerelease version "11.0.0beta2" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 11.0.0.5
@@ -75,7 +78,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - 10.0.1 to 11.0.0 beta 2
Given the current installed version is 10.0.1
- And there is an update to prerelease version of 11.0.0beta2 available
+ And there is an update to prerelease version "11.0.0beta2" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 11.0.0.5
@@ -84,7 +87,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - 10.0.0 to 10.0.2RC1
Given the current installed version is 10.0.0
- And there is an update to prerelease version of 10.0.2RC1 available
+ And there is an update to prerelease version "10.0.2RC1" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 10.0.2
@@ -93,7 +96,7 @@ Feature: CLI updater - stable10 base
Scenario: Update is available - 10.0.1 to 10.0.2RC1
Given the current installed version is 10.0.1
- And there is an update to prerelease version of 10.0.2RC1 available
+ And there is an update to prerelease version "10.0.2RC1" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 10.0.2
diff --git a/tests/features/stable11.feature b/tests/features/stable11.feature
index d1364ba..48e7750 100644
--- a/tests/features/stable11.feature
+++ b/tests/features/stable11.feature
@@ -2,7 +2,7 @@ Feature: CLI updater - stable11 base
Scenario: Update is available - 11.0.0 beta to 11.0.0 beta 2
Given the current installed version is 11.0.0beta
- And there is an update to prerelease version of 11.0.0beta2 available
+ And there is an update to prerelease version "11.0.0beta2" available
And the version number is decreased in the config.php to enforce upgrade
When the CLI updater is run successfully
And the output should contain "Update successful"
@@ -12,6 +12,7 @@ Feature: CLI updater - stable11 base
Scenario: Update is available - 11.0.0 to master daily
Given the current installed version is 11.0.0
+ And the current channel is "daily"
And there is an update to daily version of master available
When the CLI updater is run successfully
And the output should contain "Update successful"
@@ -21,6 +22,7 @@ Feature: CLI updater - stable11 base
Scenario: Update is available - 11.0.1 to master daily
Given the current installed version is 11.0.1
+ And the current channel is "daily"
And there is an update to daily version of master available
When the CLI updater is run successfully
And the output should contain "Update successful"
diff --git a/tests/features/stable9.feature b/tests/features/stable9.feature
index ed4b9b3..a23ce5a 100644
--- a/tests/features/stable9.feature
+++ b/tests/features/stable9.feature
@@ -38,6 +38,7 @@ Feature: CLI updater - stable9 base
Scenario: Update is available - 9.0.53 to stable9 daily
Given the current installed version is 9.0.53
+ And the current channel is "daily"
And there is an update to daily version of stable9 available
When the CLI updater is run successfully
And the output should contain "Update successful"
@@ -56,7 +57,7 @@ Feature: CLI updater - stable9 base
Scenario: Update is available - 9.0.54 to 9.0.55 RC1
Given the current installed version is 9.0.54
- And there is an update to prerelease version 9.0.55RC1 available
+ And there is an update to prerelease version "9.0.55RC1" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 9.0.55
@@ -65,7 +66,7 @@ Feature: CLI updater - stable9 base
Scenario: Update is available - 9.0.55 RC1 to 9.0.55 RC1 to check if the updater will run on the RC onwards
Given the current installed version is 9.0.55RC1
- And there is an update to prerelease version 9.0.55RC1 available
+ And there is an update to prerelease version "9.0.55RC1" available
And the version number is decreased in the config.php to enforce upgrade
When the CLI updater is run successfully
And the output should contain "Update successful"
@@ -75,6 +76,7 @@ Feature: CLI updater - stable9 base
Scenario: Update is available - 9.0.54 to stable9 daily
Given the current installed version is 9.0.54
+ And the current channel is "daily"
And there is an update to daily version of stable9 available
And the version number is decreased in the config.php to enforce upgrade
When the CLI updater is run successfully
@@ -85,6 +87,7 @@ Feature: CLI updater - stable9 base
Scenario: Update is available - stable9 to stable9 daily
Given the current installed version is stable9
+ And the current channel is "daily"
And there is an update to daily version of stable9 available
And the version number is decreased in the config.php to enforce upgrade
When the CLI updater is run successfully
@@ -131,7 +134,7 @@ Feature: CLI updater - stable9 base
Scenario: Update is available - 9.0.53 to 10.0.2RC1
Given the current installed version is 9.0.53
- And there is an update to prerelease version 10.0.2RC1 available
+ And there is an update to prerelease version "10.0.2RC1" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 10.0.2
@@ -140,7 +143,7 @@ Feature: CLI updater - stable9 base
Scenario: Update is available - 9.0.54 to 10.0.2RC1
Given the current installed version is 9.0.54
- And there is an update to prerelease version 10.0.2RC1 available
+ And there is an update to prerelease version "10.0.2RC1" available
When the CLI updater is run successfully
And the output should contain "Update successful"
Then the installed version should be 10.0.2
@@ -149,6 +152,7 @@ Feature: CLI updater - stable9 base
Scenario: Update is available - 9.0.54 to stable10 daily
Given the current installed version is 9.0.54
+ And the current channel is "daily"
And there is an update to daily version of stable10 available
When the CLI updater is run successfully
And the output should contain "Update successful"