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 EFF3EDABB for ; Mon, 13 Aug 2012 14:39:23 +0000 (UTC) Received: (qmail 11105 invoked by uid 500); 13 Aug 2012 14:39:23 -0000 Delivered-To: apmail-deltacloud-commits-archive@deltacloud.apache.org Received: (qmail 11077 invoked by uid 500); 13 Aug 2012 14:39:23 -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 11046 invoked by uid 99); 13 Aug 2012 14:39:23 -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, 13 Aug 2012 14:39:23 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 9D9F21CD1D; Mon, 13 Aug 2012 14:39:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mfojtik@apache.org To: commits@deltacloud.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [2/4] git commit: EC2: Added tests for the storage_volumes collection Message-Id: <20120813143923.9D9F21CD1D@tyr.zones.apache.org> Date: Mon, 13 Aug 2012 14:39:23 +0000 (UTC) EC2: Added tests for the storage_volumes collection Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/c487f555 Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/c487f555 Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/c487f555 Branch: refs/heads/master Commit: c487f5552e890b1737bb303264f1140ac650e90a Parents: 82a3253 Author: Michal Fojtik Authored: Mon Aug 13 15:11:59 2012 +0200 Committer: Michal fojtik Committed: Mon Aug 13 16:39:49 2012 +0200 ---------------------------------------------------------------------- server/lib/deltacloud/api.rb | 1 + server/lib/deltacloud/models/storage_snapshot.rb | 4 + server/tests/drivers/ec2/common.rb | 4 + ...001_must_throw_error_when_wrong_credentials.yml | 144 +- ..._0002_must_return_list_of_storage_snapshots.yml |20717 +++++++++++++++ ...0003_must_allow_to_filter_storage_snapshots.yml | 179 + ..._create_and_destroy_the_storage_snapshot-10.yml | 38 + ...o_create_and_destroy_the_storage_snapshot-9.yml | 35 + ..._to_create_and_destroy_the_storage_snapshot.yml | 135 + server/tests/drivers/ec2/storage_snapshots_test.rb | 54 + 10 files changed, 21272 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c487f555/server/lib/deltacloud/api.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/api.rb b/server/lib/deltacloud/api.rb index 56416bc..ed3d4e4 100644 --- a/server/lib/deltacloud/api.rb +++ b/server/lib/deltacloud/api.rb @@ -63,6 +63,7 @@ end class Instance; include TestPoller; end class Image; include TestPoller; end +class StorageSnapshot; include TestPoller; end module Deltacloud http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c487f555/server/lib/deltacloud/models/storage_snapshot.rb ---------------------------------------------------------------------- diff --git a/server/lib/deltacloud/models/storage_snapshot.rb b/server/lib/deltacloud/models/storage_snapshot.rb index 0f133f2..ee7e4b8 100644 --- a/server/lib/deltacloud/models/storage_snapshot.rb +++ b/server/lib/deltacloud/models/storage_snapshot.rb @@ -22,4 +22,8 @@ class StorageSnapshot < BaseModel attr_accessor :storage_volume_id attr_accessor :created + def is_completed? + state == 'completed' + end + end http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c487f555/server/tests/drivers/ec2/common.rb ---------------------------------------------------------------------- diff --git a/server/tests/drivers/ec2/common.rb b/server/tests/drivers/ec2/common.rb index c7a8249..aa2d790 100644 --- a/server/tests/drivers/ec2/common.rb +++ b/server/tests/drivers/ec2/common.rb @@ -16,6 +16,10 @@ def credentials } end +unless Time.respond_to? :be + require_relative '../../test_helper.rb' +end + Time.be(DateTime.parse("2012-07-30 11:05:00 +0000").to_s) VCR.configure do |c| http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c487f555/server/tests/drivers/ec2/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml ---------------------------------------------------------------------- diff --git a/server/tests/drivers/ec2/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml b/server/tests/drivers/ec2/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml index 6ce0384..4ef464a 100644 --- a/server/tests/drivers/ec2/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml +++ b/server/tests/drivers/ec2/fixtures/test_0001_must_throw_error_when_wrong_credentials.yml @@ -1,57 +1,123 @@ ---- -recorded_with: VCR 2.2.4 -http_interactions: -- request: +--- +http_interactions: +- request: method: get uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=unknown&Action=DescribeAvailabilityZones&Signature=RKydNEtx7th3j3t9odsCkpZS6zBYc7ooilLwma/bxNk=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-30T11:05:00.000Z&Version=2010-08-31 - body: - string: "" - headers: - Accept: - - "*/*" - User-Agent: - - "" - response: - status: + body: + encoding: UTF-8 + string: '' + headers: + Accept: + - ! '*/*' + User-Agent: + - '' + response: + status: code: 401 message: Unauthorized - headers: - Server: + headers: + Server: - AmazonEC2 - Transfer-Encoding: + Transfer-Encoding: - chunked - Date: + Date: - Mon, 30 Jul 2012 11:05:04 GMT - body: - string: |- - - AuthFailureAWS was not able to validate the provided access credentialsd6332a66-1bac-4843-80e4-5bcb65fe4ff5 + body: + encoding: UTF-8 + string: ! ' + + AuthFailureAWS was not able + to validate the provided access credentialsd6332a66-1bac-4843-80e4-5bcb65fe4ff5' http_version: recorded_at: Mon, 30 Jul 2012 11:05:00 GMT -- request: +- request: method: get uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=unknown&Action=DescribeImages&Filter.1.Name=image-type&Filter.1.Value.1=machine&Owner.1=amazon&Signature=vit58ypcZUlSmYqIVpXK2/HftGjsyMVoYsjVua3hOZ4=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-07-30T11:05:00.000Z&Version=2010-08-31 - body: - string: "" - headers: - User-Agent: - - "" - Accept: - - "*/*" - response: - status: + body: + encoding: UTF-8 + string: '' + headers: + User-Agent: + - '' + Accept: + - ! '*/*' + response: + status: code: 401 message: Unauthorized - headers: - Transfer-Encoding: + headers: + Transfer-Encoding: - chunked - Server: + Server: - AmazonEC2 - Date: + Date: - Mon, 30 Jul 2012 11:05:16 GMT - body: - string: |- - - AuthFailureAWS was not able to validate the provided access credentialsee56f88b-4548-4964-92c6-5a534bb8afb0 + body: + encoding: UTF-8 + string: ! ' + + AuthFailureAWS was not able + to validate the provided access credentialsee56f88b-4548-4964-92c6-5a534bb8afb0' http_version: recorded_at: Mon, 30 Jul 2012 11:05:00 GMT +- request: + method: get + uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=unknown&Action=DescribeImages&Filter.1.Name=image-type&Filter.1.Value.1=machine&Owner.1=amazon&Signature=q2q1o3MFJ5zA0wSCNjIlnTCTtE9R2Dfr90+z0s7Yeq8=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-08-13T12:47:00.000Z&Version=2010-08-31 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - ! '*/*' + User-Agent: + - '' + response: + status: + code: 401 + message: Unauthorized + headers: + Transfer-Encoding: + - chunked + Date: + - Mon, 13 Aug 2012 12:46:39 GMT + Server: + - AmazonEC2 + body: + encoding: US-ASCII + string: ! ' + + AuthFailureAWS was not able + to validate the provided access credentialsbfa1a6ed-76f4-46d1-9857-d71359ed8c9d' + http_version: + recorded_at: Mon, 13 Aug 2012 12:47:00 GMT +- request: + method: get + uri: https://ec2.us-east-1.amazonaws.com/?AWSAccessKeyId=unknown&Action=DescribeImages&Filter.1.Name=image-type&Filter.1.Value.1=machine&Owner.1=amazon&Signature=JWBfs00rK+BBzk5fUD1Y6oR3FMzQ0umMXcpcNxPtSpw=&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-08-13T13:03:00.000Z&Version=2010-08-31 + body: + encoding: US-ASCII + string: '' + headers: + Accept: + - ! '*/*' + User-Agent: + - '' + response: + status: + code: 401 + message: Unauthorized + headers: + Transfer-Encoding: + - chunked + Date: + - Mon, 13 Aug 2012 13:03:15 GMT + Server: + - AmazonEC2 + body: + encoding: US-ASCII + string: ! ' + + AuthFailureAWS was not able + to validate the provided access credentials703a80de-c0e3-4c73-8c80-e70afcada61d' + http_version: + recorded_at: Mon, 13 Aug 2012 13:03:00 GMT +recorded_with: VCR 2.2.4