incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik ...@mifo.sk>
Subject Re: [jira] [Commented] (DTACLOUD-33) Create unit tests for drivers like Rackspace
Date Tue, 05 Apr 2011 13:05:08 GMT
On Apr 5, 2011, at 1:47 PM, Marios Andreou (JIRA) wrote:

> 
>    [ https://issues.apache.org/jira/browse/DTACLOUD-33?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015880#comment-13015880
] 
> 
> Marios Andreou commented on DTACLOUD-33:
> ----------------------------------------
> 
> Hi Michal - thought I'd reply here since I used the patch attached here. Came across
couple issues, comments below (seperated by '======='  for sanity):
> 
> ====================================================================
> 
> * applies fine except for some whitespace errors (this is a non-issue but I put it here
for your reference):
> <stdin>:1466: trailing whitespace.
> --- 
> <stdin>:1467: trailing whitespace.
> - !ruby/struct:VCR::HTTPInteraction 
> <stdin>:1468: trailing whitespace.
>  request: !ruby/struct:VCR::Request 
> <stdin>:1471: trailing whitespace.
>    body: 
> <stdin>:1472: trailing whitespace.
>    headers: 
> warning: squelched 1197 whitespace errors
> warning: 1201 lines applied after fixing whitespace errors.

Yes, I'm sorry for this whitespace warnings but they are mostly produced by VCR cassettes,
which are 'recorded'. So I can fix that manually but IMHO for this case this is OK.


> 
> ====================================================================
> 
> * rake test:mock gave me 1 error... trace:
> 
> [marios@marios server]$ rake test:mock --trace
> (in /home/marios/Documents/WORK/NewEclipsey/DCore/deltacloud/server)
> ** Invoke test:mock (first_time)
> ** Execute test:mock
> /usr/bin/ruby -I"lib" "/home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
"tests/common.rb" "tests/drivers/mock/setup.rb" "tests/drivers/mock/images_test.rb" "tests/drivers/mock/hardware_profiles_test.rb"
"tests/drivers/mock/url_for_test.rb" "tests/drivers/mock/instance_states_test.rb" "tests/drivers/mock/instances_test.rb"
"tests/drivers/mock/api_test.rb" "tests/drivers/mock/realms_test.rb" "tests/rabbit_test.rb"
-v -v
> Loaded suite /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
> Started
> test_effective_params(DeltacloudUnitTest::ApiTest): .
> test_it_allows_accessing_docs(DeltacloudUnitTest::ApiTest): .
> test_it_change_features_after_driver_change(DeltacloudUnitTest::ApiTest): .
> test_it_expose_available_drivers(DeltacloudUnitTest::ApiTest): .
> test_it_expose_ec2_driver_entrypoints(DeltacloudUnitTest::ApiTest): E
> test_it_handles_unsupported_collections(DeltacloudUnitTest::ApiTest): .
> test_it_has_correct_attributes_set(DeltacloudUnitTest::ApiTest): .
> test_it_respond_to_head(DeltacloudUnitTest::ApiTest): .
> test_it_responses_to_html(DeltacloudUnitTest::ApiTest): .
> test_it_responses_to_json(DeltacloudUnitTest::ApiTest): .
> test_it_returns_entry_points(DeltacloudUnitTest::ApiTest): .
> test_it_supports_matrix_params(DeltacloudUnitTest::ApiTest): .
> test_it_switches_drivers(DeltacloudUnitTest::ApiTest): .
> test_params(DeltacloudUnitTest::ApiTest): .
> test_hardware_profiles_have_name(DeltacloudUnitTest::HardwareProfilesTest): .
> test_hardware_profiles_have_unique_id(DeltacloudUnitTest::HardwareProfilesTest): .
> test_hardware_profiles_have_unique_name(DeltacloudUnitTest::HardwareProfilesTest): .
> test_img1_has_correct_attributes(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_can_filter_using_architecture(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_can_filter_using_owner_id(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_can_filter_using_unknown_architecture(DeltacloudUnitTest::HardwareProfilesTest):
.
> test_it_can_filter_using_unknown_owner_id(DeltacloudUnitTest::HardwareProfilesTest):
.
> test_it_has_correct_attributes_set(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_has_unique_ids(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_has_valid_urls(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_require_authentication(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_responses_to_html(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_responses_to_json(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_returns_error_on_wrong_name(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_returns_hardware_profiles(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_returns_images(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_returns_valid_hardware_profile(DeltacloudUnitTest::HardwareProfilesTest): .
> test_it_returns_valid_image(DeltacloudUnitTest::HardwareProfilesTest): .
> test_m1_xlarge_profile_has_correct_attributes(DeltacloudUnitTest::HardwareProfilesTest):
.
> test_inst1_has_correct_attributes(DeltacloudUnitTest::InstancesTest): .
> test_it_create_a_new_instance_using_image_id(DeltacloudUnitTest::InstancesTest): .
> test_it_create_a_new_instance_using_image_id_and_name(DeltacloudUnitTest::InstancesTest):
.
> test_it_create_a_new_instance_using_image_id_and_name_and_hwp(DeltacloudUnitTest::InstancesTest):
.
> test_it_has_correct_attributes_set(DeltacloudUnitTest::InstancesTest): .
> test_it_has_unique_ids(DeltacloudUnitTest::InstancesTest): .
> test_it_require_authentication(DeltacloudUnitTest::InstancesTest): .
> test_it_responses_to_html(DeltacloudUnitTest::InstancesTest): .
> test_it_responses_to_json(DeltacloudUnitTest::InstancesTest): .
> test_it_returns_instances(DeltacloudUnitTest::InstancesTest): .
> test_it_returns_valid_realm(DeltacloudUnitTest::InstancesTest): .
> test_it_z0_stop_and_start_instance(DeltacloudUnitTest::InstancesTest): .
> test_z0_reboot_instance(DeltacloudUnitTest::InstancesTest): .
> test_z1_stop_created_instances(DeltacloudUnitTest::InstancesTest): .
> test_z2_destroy_created_instances(DeltacloudUnitTest::InstancesTest): .
> test_each_state_has_transition(DeltacloudUnitTest::RealmsTest): .
> test_it_has_correct_attributes_set(DeltacloudUnitTest::RealmsTest): .
> test_it_has_unique_ids(DeltacloudUnitTest::RealmsTest): .
> test_it_not_require_authentication(DeltacloudUnitTest::RealmsTest): .
> test_it_responses_to_html(DeltacloudUnitTest::RealmsTest): .
> test_it_responses_to_json(DeltacloudUnitTest::RealmsTest): .
> test_it_responses_to_png(DeltacloudUnitTest::RealmsTest): .
> test_it_returns_instance_states(DeltacloudUnitTest::RealmsTest): .
> test_it_returns_realms(DeltacloudUnitTest::RealmsTest): .
> test_it_returns_valid_realm(DeltacloudUnitTest::RealmsTest): .
> test_us_has_correct_attributes(DeltacloudUnitTest::RealmsTest): .
> test_it_works_for_root(DeltacloudUnitTest::UrlForTest): .
> test_it_works_for_root_absolute(DeltacloudUnitTest::UrlForTest): .
> test_it_works_when_given_absolute(DeltacloudUnitTest::UrlForTest): .
> test_it_works_when_not_at_root_context(DeltacloudUnitTest::UrlForTest): .
> test_it_works_with_spaces(DeltacloudUnitTest::UrlForTest): .
> 
> Finished in 1.785249 seconds.
> 
>  1) Error:
> test_it_expose_ec2_driver_entrypoints(DeltacloudUnitTest::ApiTest):
> NoMethodError: undefined method `do_xml_request' for #<DeltacloudUnitTest::ApiTest:0xb73ee650>
>    ./tests/../tests/drivers/mock/../../../tests/../tests/drivers/mock/../../../tests/drivers/mock/../../../tests/drivers/mock/../../../tests/drivers/mock/../../../tests/drivers/mock/api_test.rb:108:in
`test_it_expose_ec2_driver_entrypoints'
> 
> 65 tests, 0 assertions, 0 failures, 1 errors
> rake aborted!
> Command failed with status (1): [/usr/bin/ruby -I"lib" "/home/marios/.gem/r...]
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `sh'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1029:in `ruby'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `ruby'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/testtask.rb:117:in `define'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/testtask.rb:102:in `define'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
> /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/bin/rake:31
> /usr/bin/rake:19:in `load'
> /usr/bin/rake:19


Fixed. I forget to change do_xml_request in one test. Now it should work perfectly.

> ====================================================================
> 
> * rake test:rackspace gave 1 error, trace:
> 
> [marios@marios server]$ rake test:rackspace --trace
> (in /home/marios/Documents/WORK/NewEclipsey/DCore/deltacloud/server)
> ** Invoke test:rackspace (first_time)
> ** Execute test:rackspace
> /usr/bin/ruby -I"lib" "/home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
"tests/common.rb" "tests/drivers/rackspace/setup.rb" "tests/drivers/rackspace/images_test.rb"
"tests/drivers/rackspace/hardware_profiles_test.rb" "tests/drivers/rackspace/instances_test.rb"
"tests/drivers/rackspace/api_test.rb" "tests/drivers/rackspace/realms_test.rb" -v -v
> Loaded suite /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
> Started
> test_01_it_returns_entry_points(RackspaceTest::ApiTest): .
> test_02_it_has_rackspace_features(RackspaceTest::ApiTest): .
> test_03_it_has_rackspace_collections(RackspaceTest::ApiTest): F
> test_01_it_returns_hardware_profiles(RackspaceTest::HardwareProfilesTest): .
> test_02_each_hardware_profile_has_a_name(RackspaceTest::HardwareProfilesTest): .
> test_03_each_hardware_profile_has_correct_properties(RackspaceTest::HardwareProfilesTest):
.
> test_04_it_returns_single_hardware_profile(RackspaceTest::HardwareProfilesTest): .
> test_05_it_filter_hardware_profiles(RackspaceTest::HardwareProfilesTest): .
> test_01_it_returns_images(RackspaceTest::ImagesTest): .
> test_02_each_image_has_correct_properties(RackspaceTest::ImagesTest): .
> test_03_it_returns_single_image(RackspaceTest::ImagesTest): .
> test_01_01_it_can_create_instance_without_hardware_profile(RackspaceTest::InstancesTest):
.
> test_01_02_it_can_create_instance_with_hardware_profile(RackspaceTest::InstancesTest):
.
> test_02_01_created_instance_has_correct_authentication(RackspaceTest::InstancesTest):
.
> test_02_02_created_instance_has_correct_authentication(RackspaceTest::InstancesTest):
.
> test_03_01_created_instance_has_correct_addresses(RackspaceTest::InstancesTest): .
> test_03_02_created_instance_has_correct_addresses(RackspaceTest::InstancesTest): .
> test_03_02_created_instance_has_correct_hardware_profile(RackspaceTest::InstancesTest):
.
> test_04_01_created_instance_goes_to_running_state(RackspaceTest::InstancesTest): .
> test_04_02_created_instance_goes_to_running_state(RackspaceTest::InstancesTest): .
> test_05_01_created_instance_can_be_rebooted(RackspaceTest::InstancesTest): .
> test_06_01_created_instance_can_be_destroyed(RackspaceTest::InstancesTest): .
> test_06_02_created_instance_can_be_destroyed(RackspaceTest::InstancesTest): .
> test_01_it_returns_realms(RackspaceTest::RealmsTest): .
> test_02_each_realm_has_a_name(RackspaceTest::RealmsTest): .
> test_03_it_returns_single_realm(RackspaceTest::RealmsTest): .
> 
> Finished in 99.356895 seconds.
> 
>  1) Failure:
> test_03_it_has_rackspace_collections(RackspaceTest::ApiTest)
>    [/usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/expectations/fail_with.rb:41:in
`fail_with'
>     /usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/matchers/operator_matcher.rb:39:in
`fail_with_message'
>     /usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/matchers/operator_matcher.rb:61:in
`__delegate_operator'
>     /usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/matchers/operator_matcher.rb:51:in
`eval_match'
>     /usr/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/matchers/operator_matcher.rb:29:in
`=='
>     ./tests/../tests/drivers/rackspace/../../../tests/../tests/drivers/rackspace/../../../tests/drivers/rackspace/../../../tests/drivers/rackspace/api_test.rb:37:in
`test_03_it_has_rackspace_collections']:
> expected: 6,
>     got: 7 (using ==)
> 
> 26 tests, 0 assertions, 1 failures, 0 errors
> rake aborted!
> Command failed with status (1): [/usr/bin/ruby -I"lib" "/home/marios/.gem/r...]
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `sh'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1029:in `ruby'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `ruby'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/testtask.rb:117:in `define'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/testtask.rb:102:in `define'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
> /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
> /home/marios/.gem/ruby/1.8/gems/rake-0.8.7/bin/rake:31
> /usr/bin/rake:19:in `load'
> /usr/bin/rake:19

Fixed as well. I just need to update test.

> ====================================================================
> 
> * I had to install 'webmock' gem as well as vcr.

Yes, this is mentioned in Gemfile and should be mentioned also in gemspec
as *devel* dependency.

> * I wasn't sure if this version was actually 'speaking to' racksapace (i didn't get the
usual e-mail about an instance having been started so probably not) - in any case it wasn't
clear where to put creds until i looked at v3 of this series and saw you look at API_USER
or API_PASSWORD environment variables in common.rb (I set these before running the test btw)

Your Rackspace credentials are completely ignored here, until you don't change the

c.default_cassette_options = { :record => :new_episodes }

in 'setup.rb'. If you change it to 'always' it will record new episodes (refresh mock data).


> marios
> 
> 
> 
>> Create unit tests for drivers like Rackspace
>> --------------------------------------------
>> 
>>                Key: DTACLOUD-33
>>                URL: https://issues.apache.org/jira/browse/DTACLOUD-33
>>            Project: DeltaCloud
>>         Issue Type: Improvement
>>         Components: Server
>>           Reporter: Michal Fojtik
>>           Assignee: Michal Fojtik
>>        Attachments: rackspace_unit_tests.patch.zip
>> 
>> 
>> Create set of unit tests for backend drivers
> 
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira


Mime
View raw message