Return-Path: X-Original-To: apmail-deltacloud-commits-archive@www.apache.org Delivered-To: apmail-deltacloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C3084E3B5 for ; Mon, 11 Mar 2013 21:36:16 +0000 (UTC) Received: (qmail 18283 invoked by uid 500); 11 Mar 2013 21:36:15 -0000 Delivered-To: apmail-deltacloud-commits-archive@deltacloud.apache.org Received: (qmail 18154 invoked by uid 500); 11 Mar 2013 21:36:15 -0000 Mailing-List: contact commits-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list commits@deltacloud.apache.org Received: (qmail 18103 invoked by uid 99); 11 Mar 2013 21:36:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Mar 2013 21:36:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BD3B9C4EE; Mon, 11 Mar 2013 21:36:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lutter@apache.org To: commits@deltacloud.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [41/41] git commit: Revamp RHEV-M driver tests and rerecord them Message-Id: <20130311213614.BD3B9C4EE@tyr.zones.apache.org> Date: Mon, 11 Mar 2013 21:36:14 +0000 (UTC) Updated Branches: refs/heads/master f936f0943 -> 861156f87 Revamp RHEV-M driver tests and rerecord them This patch changes the tests so that they do not depend on any hardcoded values; rather, all these values are loaded from ~/.deltacloud/config * store preferences in fixtures/preferences.yml when recording * load them from there when not recording * use preference items in tests rather than hardcoded ones * use driver/credentials from config everywhere * avoid a bunch of pointless HTTP requests Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/861156f8 Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/861156f8 Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/861156f8 Branch: refs/heads/master Commit: 861156f879130700b8a381e3ad537cf5fa7d02fc Parents: e60829e Author: David Lutterkort Authored: Thu Mar 7 14:36:32 2013 -0800 Committer: David Lutterkort Committed: Mon Mar 11 12:29:12 2013 -0700 ---------------------------------------------------------------------- server/tests/drivers/rhevm/common.rb | 30 +- .../tests/drivers/rhevm/fixtures/preferences.yml | 8 + ...001_must_throw_error_when_wrong_credentials.yml | 59 +- .../test_0002_must_return_list_of_images.yml | 1514 ++- .../test_0002_must_return_list_of_instances.yml | 4356 +++--- .../test_0002_must_return_list_of_realms.yml | 536 +- ...must_support_listing_of_available_providers.yml | 441 +- .../test_0003_must_allow_to_filter_images.yml | 1254 +- .../test_0003_must_allow_to_filter_instances.yml | 7548 +--------- .../test_0003_must_allow_to_filter_realms.yml | 1281 +- ...s_when_switching_between_different_clusters.yml | 516 +- ...st_0004_must_allow_to_retrieve_single_image.yml | 163 +- ...0004_must_allow_to_retrieve_single_instance.yml | 4887 +------ ...st_0004_must_allow_to_retrieve_single_realm.yml | 801 +- ..._to_create_a_new_instance_and_destroy_it-10.yml | 1057 +-- ...w_to_create_a_new_instance_and_destroy_it-8.yml | 132 - ...w_to_create_a_new_instance_and_destroy_it-9.yml | 1059 +-- ...te_a_new_instance_and_destroy_it-destroy-10.yml | 1057 +-- ...ate_a_new_instance_and_destroy_it-destroy-9.yml | 894 +- ...low_to_create_a_new_instance_and_destroy_it.yml |11391 +------------- ...proper_exception_when_destroying_used_image.yml | 93 +- ...reate_a_new_instance_and_make_it_running-10.yml | 1057 +-- ...create_a_new_instance_and_make_it_running-8.yml | 85 +- ...create_a_new_instance_and_make_it_running-9.yml | 1059 +-- ...new_instance_and_make_it_running-destroy-10.yml | 1321 -- ..._new_instance_and_make_it_running-destroy-9.yml | 1202 -- ...a_new_instance_and_make_it_running-start-10.yml | 1320 -- ..._a_new_instance_and_make_it_running-start-4.yml | 1322 -- ..._a_new_instance_and_make_it_running-start-5.yml | 1322 -- ..._a_new_instance_and_make_it_running-start-6.yml | 1322 -- ..._a_new_instance_and_make_it_running-start-7.yml | 1322 -- ..._a_new_instance_and_make_it_running-start-8.yml | 1322 -- ..._a_new_instance_and_make_it_running-start-9.yml | 1322 -- ..._a_new_instance_and_make_it_running-stop-10.yml | 1322 -- ...e_a_new_instance_and_make_it_running-stop-3.yml | 611 - ...e_a_new_instance_and_make_it_running-stop-4.yml | 563 - ...e_a_new_instance_and_make_it_running-stop-5.yml | 612 - ...e_a_new_instance_and_make_it_running-stop-6.yml | 1321 -- ...e_a_new_instance_and_make_it_running-stop-7.yml | 1322 -- ...e_a_new_instance_and_make_it_running-stop-8.yml | 1322 -- ...e_a_new_instance_and_make_it_running-stop-9.yml | 1322 -- ...o_create_a_new_instance_and_make_it_running.yml |12312 +-------------- .../test_0006_must_support_destroying_images.yml | 356 +- server/tests/drivers/rhevm/images_test.rb | 30 +- server/tests/drivers/rhevm/instance_test.rb | 88 +- server/tests/drivers/rhevm/provider_test.rb | 16 +- server/tests/drivers/rhevm/realms_test.rb | 24 +- 47 files changed, 6846 insertions(+), 67428 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltacloud/blob/861156f8/server/tests/drivers/rhevm/common.rb ---------------------------------------------------------------------- diff --git a/server/tests/drivers/rhevm/common.rb b/server/tests/drivers/rhevm/common.rb index 6db67e5..7a1c8d3 100644 --- a/server/tests/drivers/rhevm/common.rb +++ b/server/tests/drivers/rhevm/common.rb @@ -2,16 +2,28 @@ require 'vcr' require_relative '../../test_helper' -# Credentials used to access RHEV-M server +# The configuration for RHEVM in ~/.deltacloud/config should look like +# this: +# rhevm: +# user: USERNAME +# password: PASSWORD +# provider: https://rhevm.example.com/api +# preferred: +# datacenter: UUID of a datacenter/realm +# vm: UUID of an existing instance +# template: UUID of an existing template # -# NOTE: If these are changed, the VCR fixtures need to be re-recorded -# -def credentials - { - :user => 'admin@internal', - :password => 'redhat', - :provider => 'https://dell-per610-02.lab.eng.brq.redhat.com/api;9df72b84-0234-11e2-9b87-9386d9b09d4a' - } +# Anything in the preferred part of the config is also written into +# ./fixtures/preferences.yml and used when playing back fixtures + +if vcr_recording? + Deltacloud::Test::config.save(:rhevm, File.dirname(__FILE__)) do |h| + u = URI::parse(h["provider"]) + u.host = "rhevm.example.com" + h["provider"] = u.to_s + end +else + Deltacloud::Test::config.load(:rhevm, File.dirname(__FILE__)) end VCR.configure do |c| http://git-wip-us.apache.org/repos/asf/deltacloud/blob/861156f8/server/tests/drivers/rhevm/fixtures/preferences.yml ---------------------------------------------------------------------- diff --git a/server/tests/drivers/rhevm/fixtures/preferences.yml b/server/tests/drivers/rhevm/fixtures/preferences.yml new file mode 100644 index 0000000..c77f1e7 --- /dev/null +++ b/server/tests/drivers/rhevm/fixtures/preferences.yml @@ -0,0 +1,8 @@ +--- +user: fakeuser +password: fakepassword +provider: https://rhevm.example.com/api +preferred: + datacenter: b91b0346-4ba3-11e2-a3ac-0050568c6b2d + vm: 4b4f9b94-3f85-45f3-9284-adf3deb72601 + template: da12fc7e-8f0c-4ebb-a524-5e99b3214d75 http://git-wip-us.apache.org/repos/asf/deltacloud/blob/861156f8/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml ---------------------------------------------------------------------- diff --git a/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml b/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml index 6128e1d..fc59321 100644 --- a/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml +++ b/server/tests/drivers/rhevm/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml @@ -2,58 +2,7 @@ http_interactions: - request: method: get - uri: https://unknown:wrong@dell-per610-02.lab.eng.brq.redhat.com/api/datacenters/9df72b84-0234-11e2-9b87-9386d9b09d4a - body: - encoding: UTF-8 - string: '' - headers: - Content-Type: - - application/xml - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - response: - status: - code: 401 - message: Unauthorized - headers: - Cache-Control: - - no-cache - Www-Authenticate: - - Basic realm="ENGINE" - Content-Type: - - text/html;charset=utf-8 - Set-Cookie: - - JSESSIONID=GAKFIJcON-ahGoQHZfVzT5vm; Path=/api; Secure - Content-Length: - - '978' - Pragma: - - No-cache - Expires: - - Thu, 01 Jan 1970 01:00:00 CET - Connection: - - close - Date: - - Fri, 09 Nov 2012 08:52:52 GMT - body: - encoding: UTF-8 - string: ! 'JBoss Web/7.0.16..Final-redhat-1 - Error report

HTTP - Status 401 -


type Status report

message -

description This request requires HTTP authentication - ().


JBoss Web/7.0.16..Final-redhat-1

' - http_version: - recorded_at: Fri, 09 Nov 2012 08:52:53 GMT -- request: - method: get - uri: https://unknown:wrong@10.16.120.71/api/datacenters/b9bb11c2-f397-4f41-a57b-7ac15a894779 + uri: https://fakeuser:fakepassword@rhevm.example.com/api/datacenters?search= body: encoding: US-ASCII string: '' @@ -72,7 +21,7 @@ http_interactions: message: Unauthorized headers: Date: - - Wed, 27 Feb 2013 22:30:56 GMT + - Thu, 07 Mar 2013 22:42:44 GMT Pragma: - No-cache Cache-Control: @@ -80,7 +29,7 @@ http_interactions: Expires: - Wed, 31 Dec 1969 19:00:00 EST Set-Cookie: - - JSESSIONID=AfmfC00x3rgE0rhq-nYHIgSv; Path=/api; Secure + - JSESSIONID=kAPUjqTHDinC3RYqjSPGmi55; Path=/api; Secure Www-Authenticate: - Basic realm="ENGINE" Content-Type: @@ -103,5 +52,5 @@ http_interactions:

description This request requires HTTP authentication ().


JBoss Web/7.0.16..Final-redhat-1

' http_version: - recorded_at: Wed, 27 Feb 2013 22:30:47 GMT + recorded_at: Thu, 07 Mar 2013 22:42:45 GMT recorded_with: VCR 2.4.0