summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbertagaz <bertagaz@ptitcanardnoir.org>2016-06-28 22:07:58 +0200
committerbertagaz <bertagaz@ptitcanardnoir.org>2016-06-28 22:22:59 +0200
commitc6e2de7e07de1390c88e8fa529c9c071858f69b4 (patch)
tree578b9569285deee2e9c3bcc40b13958e512b2e15
parent87843be06932ffbf80ac0f958d1521a849b864de (diff)
Retry updating APT from Synaptic on network errors.
Do not rely on the Synaptic interface to test if the update finished, given the lack of a clear notification, but test if APT processes are running, restart if its too long. Also brings better catch of Synaptic error window, as well as more robust handling of Synaptic segfaults (if any) by restarting its process. Refs: #10441
-rw-r--r--features/images/SynapticFailure.pngbin0 -> 2449 bytes
-rw-r--r--features/step_definitions/apt.rb20
2 files changed, 17 insertions, 3 deletions
diff --git a/features/images/SynapticFailure.png b/features/images/SynapticFailure.png
new file mode 100644
index 0000000..a0a702b
--- /dev/null
+++ b/features/images/SynapticFailure.png
Binary files differ
diff --git a/features/step_definitions/apt.rb b/features/step_definitions/apt.rb
index 8756803..bc2749f 100644
--- a/features/step_definitions/apt.rb
+++ b/features/step_definitions/apt.rb
@@ -29,9 +29,23 @@ Then /^I should be able to install a package using apt$/ do
end
When /^I update APT using Synaptic$/ do
- @screen.click('SynapticReloadButton.png')
- @screen.wait('SynapticReloadPrompt.png', 20)
- @screen.waitVanish('SynapticReloadPrompt.png', 30*60)
+ recovery_proc = Proc.new do
+ $vm.execute("killall synaptic")
+ step "I start Synaptic"
+ end
+ retry_tor(recovery_proc) do
+ try_for(60, :msg => "Failed to trigger the reload of the package list") {
+ # here using the Synaptic keyboard shortcut is more effective on retries.
+ @screen.type("r", Sikuli::KeyModifier.CTRL)
+ @screen.wait('SynapticReloadPrompt.png', 10)
+ }
+ try_for(900, :msg => "Took too much time to download the APT data") {
+ !$vm.execute("pidof /usr/lib/apt/methods/tor+http").success?
+ }
+ if @screen.exists('SynapticFailure.png')
+ raise "Updating APT with Synaptic failed."
+ end
+ end
end
Then /^I should be able to install a package using Synaptic$/ do