Commit 003a5a45 authored by intrigeri's avatar intrigeri

Test suite: improve robustness of cloning a Git repository

On a fast system, I've seen the "I clone the Git repository […]" scenario fail
because "test -d '/home/amnesia/testing/.git" returned 1. This check was done
just a few milliseconds after "Unpacking objects: 100%" appeared in the
Terminal. My hypothesis here is that Git takes a a little bit of time, after
displaying "Unpacking objects: 100%", until it actually puts the cloned files
into place.
parent 7b7cbcbe
......@@ -24,8 +24,12 @@ When /^I clone the Git repository "([\S]+)" in GNOME Terminal$/ do |repo|
end
Then /^the Git repository "([\S]+)" has been cloned successfully$/ do |repo|
assert($vm.directory_exist?("/home/#{LIVE_USER}/#{repo}/.git"))
assert($vm.file_exist?("/home/#{LIVE_USER}/#{repo}/.git/config"))
$vm.execute_successfully("cd '/home/#{LIVE_USER}/#{repo}/' && git status",
user: LIVE_USER)
# Git needs a strictly positive time, after seeing "Unpacking objects: 100%",
# before the conditions we check below are verified
try_for(10, msg: 'the Git repository has not been cloned') do
$vm.directory_exist?("/home/#{LIVE_USER}/#{repo}/.git")
$vm.file_exist?("/home/#{LIVE_USER}/#{repo}/.git/config")
$vm.execute("cd '/home/#{LIVE_USER}/#{repo}/' && git status",
user: LIVE_USER).success?
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment