Bug 791216 - Tests for Aeolus::Image::Factory::Base with OAuth randomly fails
Summary: Tests for Aeolus::Image::Factory::Base with OAuth randomly fails
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: CloudForms Cloud Engine
Classification: Retired
Component: aeolus-all
Version: 1.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
Assignee: Petr Blaho
QA Contact: wes hayutin
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-16 14:27 UTC by Petr Blaho
Modified: 2012-08-30 17:14 UTC (History)
4 users (show)

Fixed In Version: v0.3.0-10
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-30 17:14:23 UTC
Embargoed:


Attachments (Terms of Use)

Description Petr Blaho 2012-02-16 14:27:07 UTC
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.

Comment 1 Petr Blaho 2012-02-16 14:35:15 UTC
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.

Comment 2 Petr Blaho 2012-02-22 15:33:47 UTC
Posted patch for problematic tests:

https://fedorahosted.org/pipermail/aeolus-devel/2012-February/009099.html

Comment 3 Petr Blaho 2012-02-23 14:20:47 UTC
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

Comment 4 Petr Blaho 2012-02-23 15:51:01 UTC
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

Comment 5 Steve Linabery 2012-02-24 04:21:14 UTC
5c1dcce4b29ab840e915b9401cb170ad57c3f985

Comment 6 Shveta 2012-03-01 13:49:35 UTC
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

Comment 7 Shveta 2012-03-02 06:01:27 UTC
<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


Note You need to log in before you can comment on or make changes to this bug.