summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2019-03-05 10:36:43 +0000
committerintrigeri <intrigeri@boum.org>2019-03-05 10:36:43 +0000
commit79ea3b26777f9f0de457b3b4310fac46e951c3f5 (patch)
tree10cb2ef24a249e3627fb43cc53f6428272fbe914
parent886fc3b52337e82ead2b8dd26b86c6e6da21a2f5 (diff)
Test suite: use $vm.execute vs $vm.execute_successfully consistently (refs: #14596)
… and document a bit a few cases where one might wonder why we're not using vm.execute_successfully.
-rw-r--r--features/step_definitions/additional_software_packages.rb2
-rw-r--r--features/step_definitions/apt.rb10
2 files changed, 8 insertions, 4 deletions
diff --git a/features/step_definitions/additional_software_packages.rb b/features/step_definitions/additional_software_packages.rb
index c3a87ee..4caebf6 100644
--- a/features/step_definitions/additional_software_packages.rb
+++ b/features/step_definitions/additional_software_packages.rb
@@ -107,7 +107,7 @@ DPkg::Pre-Invoke {
EOF
$vm.file_overwrite('/etc/apt/apt.conf.d/00failingDPKGhook', failing_dpkg_hook)
# Tell the upgrade service check step not to run
- $vm.execute("touch #{ASP_STATE_DIR}/doomed_to_fail")
+ $vm.execute_successfully("touch #{ASP_STATE_DIR}/doomed_to_fail")
end
When /^I remove the "([^"]*)" deb files from the APT cache$/ do |package|
diff --git a/features/step_definitions/apt.rb b/features/step_definitions/apt.rb
index 7f2a827..4941bad 100644
--- a/features/step_definitions/apt.rb
+++ b/features/step_definitions/apt.rb
@@ -60,6 +60,8 @@ end
Then /^I install "(.+)" using apt$/ do |package|
recovery_proc = Proc.new do
step 'I kill the process "apt"'
+ # We can't use execute_successfully here: the package might not be
+ # installed at this point, and then "apt purge" would return non-zero.
$vm.execute("apt purge #{package}")
end
retry_tor(recovery_proc) do
@@ -82,7 +84,7 @@ def check_for_removal(package)
end
Then /^I uninstall "(.+)" using apt$/ do |package|
- $vm.execute("echo #{@sudo_password} | " +
+ $vm.execute_successfully("echo #{@sudo_password} | " +
"sudo -S apt -y purge #{package}",
:user => LIVE_USER,
:spawn => true)
@@ -105,14 +107,14 @@ When /^I install an old version "([^"]*)" of the cowsay package using apt$/ do |
end
When /^I revert the APT tweaks that made it prefer an old version of cowsay$/ do
- $vm.execute('rm -f /etc/apt/sources.list.d/asp-test-upgrade-cowsay.list /etc/apt/preferences.d/asp-test-upgrade-cowsay')
+ $vm.execute_successfully('rm -f /etc/apt/sources.list.d/asp-test-upgrade-cowsay.list /etc/apt/preferences.d/asp-test-upgrade-cowsay')
end
When /^the installed version of package "([^"]*)" is( newer than)? "([^"]*)"( after Additional Software has been started)?$/ do |package, newer_than, version, asp|
if asp
step 'the Additional Software installation service has started'
end
- current_version = $vm.execute("dpkg-query -W -f='${Version}' #{package}").stdout
+ current_version = $vm.execute_successfully("dpkg-query -W -f='${Version}' #{package}").stdout
if newer_than
cmd_helper("dpkg --compare-versions '#{version}' lt '#{current_version}'")
else
@@ -155,6 +157,8 @@ end
Then /^I install "(.+)" using Synaptic$/ do |package_name|
recovery_proc = Proc.new do
step 'I kill the process "synaptic"'
+ # We can't use execute_successfully here: the package might not be
+ # installed at this point, and then "apt purge" would return non-zero.
$vm.execute("apt -y purge #{package_name}")
step "I start Synaptic"
end