Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DDA5FEA2F for ; Thu, 24 Jan 2013 12:17:03 +0000 (UTC) Received: (qmail 31153 invoked by uid 500); 24 Jan 2013 12:17:03 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 31124 invoked by uid 500); 24 Jan 2013 12:17:03 -0000 Mailing-List: contact dev-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 dev@deltacloud.apache.org Received: (qmail 31110 invoked by uid 99); 24 Jan 2013 12:17:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jan 2013 12:17:03 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.87.233.190] (HELO cluster-g.mailcontrol.com) (208.87.233.190) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jan 2013 12:16:51 +0000 Received: from mail1.fujitsu.com.au (mail1.fujitsu.com.au [216.14.192.229]) by rly23g.srv.mailcontrol.com (MailControl) with ESMTP id r0OCGQjD014517 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 24 Jan 2013 12:16:28 GMT Received: from localhost (localhost.localdomain [127.0.0.1]) by mail1.fujitsu.com.au (Postfix) with ESMTP id 86EE329D654 for ; Thu, 24 Jan 2013 23:16:26 +1100 (EST) X-Virus-Scanned: amavisd-new at mail1.fujitsu.com.au Received: from mail1.fujitsu.com.au ([127.0.0.1]) by localhost (mail1.fujitsu.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AhZCzsaWte3v for ; Thu, 24 Jan 2013 23:16:26 +1100 (EST) Received: from SYD0633.au.fujitsu.com (unknown [137.172.78.131]) by mail1.fujitsu.com.au (Postfix) with ESMTP id 5AD5329D652 for ; Thu, 24 Jan 2013 23:16:26 +1100 (EST) Received: from mailfilter1.au.fjanz.com (137.172.19.78) by SYD0632.au.fujitsu.com (137.172.78.131) with Microsoft SMTP Server id 8.3.83.0; Thu, 24 Jan 2013 23:16:26 +1100 Received: from RadwareLoad Balancer (137.172.78.70) [137.172.78.70] by mailfilter1.au.fjanz.com - Websense Email Security (7.0.0); Thu, 24 Jan 2013 23:16:26 +1100 Received: from FALEX03.au.fjanz.com ([137.172.72.103]) by SYD0665.au.fjanz.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 24 Jan 2013 23:16:15 +1100 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH] Black box tests - check if collection supported before creating test resource Date: Thu, 24 Jan 2013 23:16:14 +1100 Message-ID: <434A0ECB689CAF49A3A2321F30F2AB8324902788@FALEX03.au.fjanz.com> In-Reply-To: <1359026070-14855-1-git-send-email-marios@redhat.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] Black box tests - check if collection supported before creating test resource Thread-Index: Ac36JBheH0SZgTGOSjiTWhJfjat+IAAAG6SA References: <1359026070-14855-1-git-send-email-marios@redhat.com> From: "Koper, Dies" To: X-OriginalArrivalTime: 24 Jan 2013 12:16:15.0924 (UTC) FILETIME=[9B934F40:01CDFA2C] X-SEF-Processed: 7_0_0_00239__2013_01_24_23_16_26 X-Scanned-By: MailControl 11783.69 (www.mailcontrol.com) on 10.71.0.133 X-Virus-Checked: Checked by ClamAV on apache.org Hi Marios, Reviewed and tested to work. ACK with nit: > + def collection_supported(name) > + return true if api.collections.include?(name.to_sym) > + false > + end Why not just: + def collection_supported(name) + api.collections.include?(name.to_sym) + end Cheers, Dies Koper > -----Original Message----- > From: marios@redhat.com [mailto:marios@redhat.com] > Sent: Thursday, 24 January 2013 10:15 PM > To: dev@deltacloud.apache.org > Subject: [PATCH] Black box tests - check if collection supported before > creating test resource >=20 > From: marios >=20 >=20 > Signed-off-by: marios > --- > tests/deltacloud/buckets_test.rb | 2 +- > tests/deltacloud/instances_test.rb | 2 +- > tests/deltacloud/test_setup.rb | 7 +++++++ > 3 files changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/tests/deltacloud/buckets_test.rb > b/tests/deltacloud/buckets_test.rb > index 38fc120..c9ac7f5 100644 > --- a/tests/deltacloud/buckets_test.rb > +++ b/tests/deltacloud/buckets_test.rb > @@ -50,7 +50,7 @@ describe 'Deltacloud API buckets collection' do > unless res.code =3D=3D 200 > raise Exception.new("Failed to create blob #{@@my_blob}") > end > - end > + end if collection_supported :buckets >=20 > # delete the bucket/blob we created for the tests > MiniTest::Unit.after_tests { > diff --git a/tests/deltacloud/instances_test.rb > b/tests/deltacloud/instances_test.rb > index d6a916c..73b5ed2 100644 > --- a/tests/deltacloud/instances_test.rb > +++ b/tests/deltacloud/instances_test.rb > @@ -33,7 +33,7 @@ describe 'Deltacloud API instances collection' do > end > @@my_instance_id =3D (res.xml/'instance')[0][:id] > @@created_resources[:instances] << @@my_instance_id > - end > + end if collection_supported :instances >=20 > #stop/destroy the resources we created for the tests > MiniTest::Unit.after_tests { > diff --git a/tests/deltacloud/test_setup.rb b/tests/deltacloud/test_setup.rb > index c75b046..b28e456 100644 > --- a/tests/deltacloud/test_setup.rb > +++ b/tests/deltacloud/test_setup.rb > @@ -237,6 +237,13 @@ module Deltacloud::Test::Methods > end > end >=20 > + #convenience method for checking if collection :foo is supported: > + def collection_supported(name) > + return true if api.collections.include?(name.to_sym) > + false > + end > + > + > # Only run tests if collection +collection+ supports feature +name+ in > # the current driver. Use inside a 'describe' block. Tests that are not > # run because of a missing collection are marked as skipped > -- > 1.7.11.7 >=20