Make username/password test more robust, faster 54/66954/8
authorDaniel Farrell <dfarrell@redhat.com>
Mon, 8 Jan 2018 22:06:29 +0000 (17:06 -0500)
committerDaniel Farrell <dfarrell@redhat.com>
Wed, 10 Jan 2018 19:58:37 +0000 (14:58 -0500)
Test currently sporadically fails due to timing, and also wastes time
with a hard 180s sleep. Replace sleep with active polling, increase max
wait time.

Change-Id: I01ebe37b3adc106b1eef9bb5c810bddca9b437d2
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
spec/spec_helper_acceptance.rb

index 92c2810772f5be2bb265295ce6ddcdb16e0cc876..d1e1eee2f55322fedc8c02ec5e55f00eea7062db 100644 (file)
@@ -398,9 +398,13 @@ def username_password_validations(options = {})
     it { should be_file }
   end
 
-  #describe command("sleep 300 && curl -o /dev/null --fail --silent --head -u #{odl_username}:#{odl_password} #{odl_check_url}") do
-  #  its(:exit_status) { should eq 0 }
-  #end
+  describe command("loop_count=0; until [[ \$loop_count -ge 300 ]]; do curl -o /dev/null --fail --silent --head -u #{odl_username}:#{odl_password} #{odl_check_url} && break; loop_count=\$[\$loop_count+1]; sleep 1; done; echo \"Waited \$loop_count seconds for ODL to become active\"") do
+    its(:exit_status) { should eq 0 }
+  end
+
+  describe command("curl -o /dev/null --fail --silent --head -u #{odl_username}:#{odl_password} #{odl_check_url}") do
+    its(:exit_status) { should eq 0 }
+  end
 end
 
 # Shared function for validations related to the SNAT config file