Description of problem: Tests for Aeolus::Image::Factory::Base with OAuth randomly fails. These tests make connection to imagefactory and this connection should be answered by VCR cassette. But sometimes connection request pass through and it is not answered by VCR - in this point test fails (obviously). Version-Release number of selected component (if applicable): How reproducible: Run rake spec SPEC=spec/models/factory/base.rb or rspec spec/models/factory/base.rb a few times and compare results Additional info: Additionaly it would be good to rename spec/models/factory/base.rb and spec/models/factory/build.rb to their variants with _spec suffix. Without this suffix simple rspec spec command ignores these files.
There is a problem with hash argument passed to ActiveRecord::Connection.request method. VCR is set up to match requests by uri, method and body. But hash has no specified order of keys, so sometimes that hash argument translates to body not matched by VCR. To avoid this and to improve overall structure of tests I will refactor this tests to use separate VCR cassette for each test - now these tests use one common VCR cassette.
Posted patch for problematic tests: https://fedorahosted.org/pipermail/aeolus-devel/2012-February/009099.html
Resent after some comments on list. Patch is divided into two parts - one renaming spec files and second solution to bug. https://fedorahosted.org/pipermail/aeolus-devel/2012-February/009125.html
Pushed to master: commit 91a9e528f61826657268ac127d501a6727e13dff Author: Petr Blaho <pblaho> Date: Thu Feb 23 15:14:11 2012 +0100 Resolve VCR problem with matching requests Refactored some tests code to bypass VCR request matching problem https://bugzilla.redhat.com/show_bug.cgi?id=791216 commit 64216740e436e5ebcd5ec93801d1915b5b0df053 Author: Petr Blaho <pblaho> Date: Thu Feb 23 14:57:43 2012 +0100 Rename of some spec files - add _spec suffix https://bugzilla.redhat.com/show_bug.cgi?id=791216
5c1dcce4b29ab840e915b9401cb170ad57c3f985
Pulled the source code ==================================================== git clone git://github.com/aeolusproject/aeolus-image-rubygem.git Initialized empty Git repository in /root/aeolus-image-rubygem/.git/ remote: Counting objects: 963, done. remote: Compressing objects: 100% (363/363), done. remote: Total 963 (delta 569), reused 961 (delta 567) Receiving objects: 100% (963/963), 153.60 KiB, done. Resolving deltas: 100% (569/569), done. =============================================== [root@qe-blade-14 ~]# cd aeolus-image-rubygem/ [root@qe-blade-14 aeolus-image-rubygem]# ll total 44 -rw-r--r--. 1 root root 760 Mar 1 08:41 aeolus-image.gemspec -rw-r--r--. 1 root root 9141 Mar 1 08:41 COPYING drwxr-xr-x. 2 root root 4096 Mar 1 08:41 examples drwxr-xr-x. 3 root root 4096 Mar 1 08:41 lib drwxr-xr-x. 2 root root 4096 Mar 1 08:41 rake -rw-r--r--. 1 root root 2418 Mar 1 08:41 Rakefile -rw-r--r--. 1 root root 1237 Mar 1 08:41 README.md -rw-r--r--. 1 root root 3778 Mar 1 08:41 rubygem-aeolus-image.spec.in drwxr-xr-x. 5 root root 4096 Mar 1 08:41 spec [root@qe-blade-14 aeolus-image-rubygem]# rake spec SPEC=spec/models/factory/base_spec.rb /usr/bin/ruby -S rspec spec/models/factory/base_spec.rb /root/aeolus-image-rubygem/lib/aeolus_image/model/warehouse/image.rb:19: warning: already initialized constant OS Aeolus::Image::Factory::Base should not use_oauth? if configuration is missing should use_oauth? if configuration is present should succeed with valid OAuth credentials should fail with invalid OAuth credentials should fail with no OAuth credentials Finished in 0.08629 seconds 5 examples, 0 failures [root@qe-blade-14 aeolus-image-rubygem]# rake spec SPEC=spec/models/factory/base_spec.rb /usr/bin/ruby -S rspec spec/models/factory/base_spec.rb /root/aeolus-image-rubygem/lib/aeolus_image/model/warehouse/image.rb:19: warning: already initialized constant OS Aeolus::Image::Factory::Base should not use_oauth? if configuration is missing should use_oauth? if configuration is present should succeed with valid OAuth credentials should fail with invalid OAuth credentials should fail with no OAuth credentials Finished in 0.0859 seconds 5 examples, 0 failures [root@qe-blade-14 aeolus-image-rubygem]# rake spec SPEC=spec/models/factory/base_spec.rb /usr/bin/ruby -S rspec spec/models/factory/base_spec.rb /root/aeolus-image-rubygem/lib/aeolus_image/model/warehouse/image.rb:19: warning: already initialized constant OS Aeolus::Image::Factory::Base should not use_oauth? if configuration is missing should use_oauth? if configuration is present should succeed with valid OAuth credentials should fail with invalid OAuth credentials should fail with no OAuth credentials Finished in 0.08575 seconds 5 examples, 0 failures [root@qe-blade-14 aeolus-image-rubygem]# rake spec SPEC=spec/models/factory/base_spec.rb /usr/bin/ruby -S rspec spec/models/factory/base_spec.rb /root/aeolus-image-rubygem/lib/aeolus_image/model/warehouse/image.rb:19: warning: already initialized constant OS Aeolus::Image::Factory::Base should not use_oauth? if configuration is missing should use_oauth? if configuration is present should succeed with valid OAuth credentials should fail with invalid OAuth credentials should fail with no OAuth credentials Finished in 0.08587 seconds 5 examples, 0 failures [root@qe-blade-14 aeolus-image-rubygem]# rake spec SPEC=spec/models/factory/base_spec.rb /usr/bin/ruby -S rspec spec/models/factory/base_spec.rb /root/aeolus-image-rubygem/lib/aeolus_image/model/warehouse/image.rb:19: warning: already initialized constant OS Aeolus::Image::Factory::Base should not use_oauth? if configuration is missing should use_oauth? if configuration is present should succeed with valid OAuth credentials should fail with invalid OAuth credentials should fail with no OAuth credentials Finished in 0.0861 seconds 5 examples, 0 failures [root@qe-blade-14 aeolus-image-rubygem]# rake spec SPEC=spec/models/factory/base_spec.rb
<pblaho> git://github.com/aeolusproject/aeolus-image-rubygem.git <pblaho> cd aeolus-image-rubygem <pblaho> the same rake command <pblaho> the problem was in random order of keys in body of one request <pblaho> so it occured in 50/50 <pblaho> just run it maybe 10 or so and if it will not fail it is ok <pblaho> it seems ok all tests passed