Add polling for image list tests

10 seconds might not be long enough for an image to upload, but we
don't want to wait forever either. Have the image upload beaker tests
poll the image list for up to 60 seconds while it is saving before
checking whether the image ever became active.

Change-Id: If9c6ba60a18aac30bbb12d106cbbeddb1f126460
This commit is contained in:
Colleen Murphy 2016-06-13 08:50:24 -07:00
parent 2481f30e5d
commit b8615676b3
1 changed files with 10 additions and 4 deletions

View File

@ -113,10 +113,16 @@ describe 'allinone', :if => os[:family] == 'ubuntu' do
cirros'
result = shell("#{credentials} #{command}")
expect(result.exit_code).to eq(0)
sleep(10) # command returns immediately but image needs time to upload
result = shell("#{credentials} openstack image list --long")
expect(result.stdout).to match(/cirros.*active/)
expect(result.exit_code).to eq(0)
list_command = "#{credentials} openstack image list --long"
timeout = 60
end_time = Time.now + timeout
image_list = shell(list_command)
while image_list.stdout =~ /saving/ && Time.now() < end_time
sleep(10)
image_list = shell(list_command)
end
expect(image_list.stdout).to match(/cirros.*active/)
expect(image_list.exit_code).to eq(0)
end
it 'should be able to upload a keypair' do